Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash result set name in sorted result set path #2955

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Sorted result set filenames now include a hash of the result set name instead of the full name. [#2955](https://github.com/github/vscode-codeql/pull/2955)

## 1.9.2 - 12 October 2023

- Fix a bug where the query to Find Definitions in database source files would not be cancelled appropriately. [#2885](https://github.com/github/vscode-codeql/pull/2885)
Expand Down
8 changes: 7 additions & 1 deletion extensions/ql-vscode/src/run-queries-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { BaseLogger, showAndLogWarningMessage } from "./common/logging";
import { extLogger } from "./common/logging/vscode";
import { generateSummarySymbolsFile } from "./log-insights/summary-parser";
import { getErrorMessage } from "./common/helpers-pure";
import { createHash } from "crypto";

/**
* run-queries.ts
Expand Down Expand Up @@ -150,7 +151,12 @@ export class QueryEvaluationInfo extends QueryOutputDir {
};
}
getSortedResultSetPath(resultSetName: string) {
return join(this.querySaveDir, `sortedResults-${resultSetName}.bqrs`);
const hasher = createHash("sha256");
hasher.update(resultSetName);
return join(
this.querySaveDir,
`sortedResults-${hasher.digest("hex")}.bqrs`,
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe("query-results", () => {
const expectedResultsPath = join(queryPath, "results.bqrs");
const expectedSortedResultsPath = join(
queryPath,
"sortedResults-a-result-set-name.bqrs",
"sortedResults-cc8589f226adc134f87f2438e10075e0667571c72342068e2281e0b3b65e1092.bqrs",
);
expect(spy).toBeCalledWith(
expectedResultsPath,
Expand Down
Loading