Re-enable duplicate SARIF notification location workaround

This commit is contained in:
Henry Mercer 2023-04-06 14:48:04 +01:00
parent f32426ba96
commit 7193623f40
3 changed files with 10 additions and 27 deletions

14
lib/codeql.js generated
View file

@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.enrichEnvironment = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_TRACING_GLIBC_2_34 = exports.CODEQL_VERSION_NEW_TRACING = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0; exports.enrichEnvironment = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_TRACING_GLIBC_2_34 = exports.CODEQL_VERSION_NEW_TRACING = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
@ -106,11 +106,6 @@ exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`. * Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
*/ */
exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4"; exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
/**
* Versions 2.12.6+ of the CodeQL CLI fix a bug where duplicate notification objects could be produced,
* leading to an invalid SARIF output.
*/
exports.CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED = "2.12.6";
/** /**
* Set up CodeQL CLI access. * Set up CodeQL CLI access.
* *
@ -514,8 +509,8 @@ async function getCodeQLForCmd(cmd, checkVersion) {
}, },
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features, logger) { async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features, logger) {
const shouldExportDiagnostics = await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, this); const shouldExportDiagnostics = await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, this);
const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics && // Update this to take into account the CodeQL version when we have a version with the fix.
!(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED)); const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics;
const codeqlOutputFile = shouldWorkaroundInvalidNotifications const codeqlOutputFile = shouldWorkaroundInvalidNotifications
? path.join(config.tempDir, "codeql-intermediate-results.sarif") ? path.join(config.tempDir, "codeql-intermediate-results.sarif")
: sarifFile; : sarifFile;
@ -633,7 +628,8 @@ async function getCodeQLForCmd(cmd, checkVersion) {
await new toolrunner.ToolRunner(cmd, args).exec(); await new toolrunner.ToolRunner(cmd, args).exec();
}, },
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId, tempDir, logger) { async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId, tempDir, logger) {
const shouldWorkaroundInvalidNotifications = !(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED)); // Update this to take into account the CodeQL version when we have a version with the fix.
const shouldWorkaroundInvalidNotifications = true;
const codeqlOutputFile = shouldWorkaroundInvalidNotifications const codeqlOutputFile = shouldWorkaroundInvalidNotifications
? path.join(tempDir, "codeql-intermediate-results.sarif") ? path.join(tempDir, "codeql-intermediate-results.sarif")
: sarifFile; : sarifFile;

File diff suppressed because one or more lines are too long

View file

@ -319,12 +319,6 @@ export const CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
*/ */
export const CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4"; export const CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
/**
* Versions 2.12.6+ of the CodeQL CLI fix a bug where duplicate notification objects could be produced,
* leading to an invalid SARIF output.
*/
export const CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED = "2.12.6";
/** /**
* Set up CodeQL CLI access. * Set up CodeQL CLI access.
* *
@ -884,12 +878,8 @@ export async function getCodeQLForCmd(
Feature.ExportDiagnosticsEnabled, Feature.ExportDiagnosticsEnabled,
this this
); );
const shouldWorkaroundInvalidNotifications = // Update this to take into account the CodeQL version when we have a version with the fix.
shouldExportDiagnostics && const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics;
!(await util.codeQlVersionAbove(
this,
CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED
));
const codeqlOutputFile = shouldWorkaroundInvalidNotifications const codeqlOutputFile = shouldWorkaroundInvalidNotifications
? path.join(config.tempDir, "codeql-intermediate-results.sarif") ? path.join(config.tempDir, "codeql-intermediate-results.sarif")
: sarifFile; : sarifFile;
@ -1039,11 +1029,8 @@ export async function getCodeQLForCmd(
tempDir: string, tempDir: string,
logger: Logger logger: Logger
): Promise<void> { ): Promise<void> {
const shouldWorkaroundInvalidNotifications = // Update this to take into account the CodeQL version when we have a version with the fix.
!(await util.codeQlVersionAbove( const shouldWorkaroundInvalidNotifications = true;
this,
CODEQL_VERSION_DUPLICATE_NOTIFICATIONS_FIXED
));
const codeqlOutputFile = shouldWorkaroundInvalidNotifications const codeqlOutputFile = shouldWorkaroundInvalidNotifications
? path.join(tempDir, "codeql-intermediate-results.sarif") ? path.join(tempDir, "codeql-intermediate-results.sarif")
: sarifFile; : sarifFile;