Skip to content

Commit 49dc344

Browse files
committed
3rd attempt to fix github-advanced-security rule violation: js/polynomial-redos (Polynomial regular expression used on uncontrolled data)
1 parent 1961ddb commit 49dc344

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/search/SearchRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ export class SearchRequest {
419419
static extractQuotedStrings = (searchText: string): string[] => {
420420
// based on code generated by gemini
421421
// Regex to find tokens: quoted strings with escaped quotes, or unquoted words.
422-
const regex = /"[^"\\]*(?:\\.[^"\\]*)*"|[\S]+/g;
422+
const regex = /"[^"]*"|[\S]+/g
423423
// const regex = /"([^"]*)"/g;
424424
const matches = searchText.match(regex);
425425
return matches ?? [];

src/search/test_cases/search_exactPhrase.test.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Wildcard Searches', () => {
3636
{ input: `"CVE-20??-*"`, expected: [`CVE-20??-*`] },
3737
// phrase with unequal quotes (edge cases)
3838
{ input: `"microsoft office`, expected: [`"microsoft`, `office`] },
39-
{ input: `"\\"abc\\"`, expected: [`"abc\\`] },
39+
{ input: `"\\"abc\\"`, expected: [`\\`, `abc\\"`] },
4040
{ input: `"""`, expected: [``, ``] },
4141
{ input: `a"b`, expected: [`a"b`] },
4242
{ input: `a\"b`, expected: [`a"b`] },

0 commit comments

Comments
 (0)