Merge pull request #2955 from github/kaspersv/hash-result-set-in-bqrs-filename

Hash result set name in sorted result set path
This commit is contained in:
Kasper Svendsen
2023-10-12 14:17:47 +02:00
committed by GitHub
3 changed files with 10 additions and 2 deletions

View File

@@ -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)

View File

@@ -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
@@ -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`,
);
}
/**

View File

@@ -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,