We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1b053cd + f759462 commit ea03140Copy full SHA for ea03140
src/lib/query.ts
@@ -30,11 +30,15 @@ export class Query extends BaseQuery {
30
31
// Validate if input matches any of the safe, pre-approved patterns
32
private isValidRegexPattern(input: string): boolean {
33
+ const validRegex = /^[a-zA-Z0-9|^$.*+?()[\]{}\\-]+$/; // Allow only safe regex characters
34
+ if (!validRegex.test(input)) {
35
+ return false;
36
+ }
37
try {
- new RegExp(input); // Try to create a new RegExp object
- return true; // No error means it's a valid regex
38
+ new RegExp(input);
39
+ return true;
40
} catch (e) {
- return false; // Error means it's not a valid regex
41
42
}
43
44
0 commit comments