Skip to content

Commit

Permalink
Merge pull request #269 from Security-Onion-Solutions/cogburn/query-p…
Browse files Browse the repository at this point in the history
…arser-fix

Query Parser Fix
  • Loading branch information
coreyogburn authored Aug 1, 2023
2 parents 615e57d + 7a25538 commit 846f575
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion html/js/routes/hunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ const huntComponent = {
break;
} else if (this.query[i] == "\"" && !escaping) {
insideQuote = !insideQuote;
} else if (this.query[i] == "\\") {
} else if (this.query[i] == "\\" && !escaping) {
escaping = true;
} else {
escaping = false;
Expand Down
10 changes: 10 additions & 0 deletions html/js/routes/hunt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,16 @@ test('obtainQueryDetails_queryGroupedFilterPipe', () => {
expect(comp.querySortBys).toStrictEqual([]);
});

test('obtainQueryDetails_trickyEscapeSequence', () => {
comp.query = `process.working_directory:"C:\\\\Windows\\\\system32\\\\" | groupby host.name`;
comp.obtainQueryDetails();
expect(comp.queryName).toBe("Custom");
expect(comp.queryFilters).toStrictEqual([`process.working_directory:"C:\\\\Windows\\\\system32\\\\"`]);
expect(comp.queryGroupBys).toStrictEqual([["host.name"]]);
expect(comp.queryGroupByOptions).toStrictEqual([[]]);
expect(comp.querySortBys).toStrictEqual([]);
});

test('query string filterToggles', () => {
comp.$route = { path: "hunt", query: { socExcludeToggle: false } };
comp.filterToggles = [{
Expand Down

0 comments on commit 846f575

Please sign in to comment.