From bd56a05133734527a524799b550f71febf4597b9 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Wed, 28 Feb 2024 19:25:30 +0000 Subject: [PATCH] Rename `InvalidRequestError` to `InvalidSarifUploadError` Nitty: make it a little clearer when this shows up in the logs what type of request we mean --- lib/upload-lib.js | 22 +++++++++++----------- lib/upload-lib.js.map | 2 +- src/upload-lib.ts | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/upload-lib.js b/lib/upload-lib.js index d843310d87..5285c9c965 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -56,7 +56,7 @@ function combineSarifFiles(sarifFiles) { combinedSarif.version = sarifObject.version; } else if (combinedSarif.version !== sarifObject.version) { - throw new InvalidRequestError(`Different SARIF versions encountered: ${combinedSarif.version} and ${sarifObject.version}`); + throw new InvalidSarifUploadError(`Different SARIF versions encountered: ${combinedSarif.version} and ${sarifObject.version}`); } combinedSarif.runs.push(...sarifObject.runs); } @@ -162,7 +162,7 @@ async function uploadFromActions(sarifPath, checkoutPath, category, logger, { is return await uploadFiles(getSarifFilePaths(sarifPath), (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")), await actionsUtil.getCommitOid(checkoutPath), await actionsUtil.getRef(), await api.getAnalysisKey(), category, util.getRequiredEnvParam("GITHUB_WORKFLOW"), actionsUtil.getWorkflowRunID(), actionsUtil.getWorkflowRunAttempt(), checkoutPath, actionsUtil.getRequiredInput("matrix"), logger); } catch (e) { - if (e instanceof InvalidRequestError && isThirdPartyUpload) { + if (e instanceof InvalidSarifUploadError && isThirdPartyUpload) { throw new util_1.ConfigurationError(e.message); } throw e; @@ -171,13 +171,13 @@ async function uploadFromActions(sarifPath, checkoutPath, category, logger, { is exports.uploadFromActions = uploadFromActions; function getSarifFilePaths(sarifPath) { if (!fs.existsSync(sarifPath)) { - throw new InvalidRequestError(`Path does not exist: ${sarifPath}`); + throw new InvalidSarifUploadError(`Path does not exist: ${sarifPath}`); } let sarifFiles; if (fs.lstatSync(sarifPath).isDirectory()) { sarifFiles = findSarifFilesInDir(sarifPath); if (sarifFiles.length === 0) { - throw new InvalidRequestError(`No SARIF files found to upload in "${sarifPath}".`); + throw new InvalidSarifUploadError(`No SARIF files found to upload in "${sarifPath}".`); } } else { @@ -190,11 +190,11 @@ function countResultsInSarif(sarif) { let numResults = 0; const parsedSarif = JSON.parse(sarif); if (!Array.isArray(parsedSarif.runs)) { - throw new InvalidRequestError("Invalid SARIF. Missing 'runs' array."); + throw new InvalidSarifUploadError("Invalid SARIF. Missing 'runs' array."); } for (const run of parsedSarif.runs) { if (!Array.isArray(run.results)) { - throw new InvalidRequestError("Invalid SARIF. Missing 'results' array in run."); + throw new InvalidSarifUploadError("Invalid SARIF. Missing 'results' array in run."); } numResults += run.results.length; } @@ -208,7 +208,7 @@ function validateSarifFileSchema(sarifFilePath, logger) { sarif = JSON.parse(fs.readFileSync(sarifFilePath, "utf8")); } catch (e) { - throw new InvalidRequestError(`Invalid SARIF. JSON syntax error: ${(0, util_1.wrapError)(e).message}`); + throw new InvalidSarifUploadError(`Invalid SARIF. JSON syntax error: ${(0, util_1.wrapError)(e).message}`); } const schema = require("../src/sarif-schema-2.1.0.json"); const result = new jsonschema.Validator().validate(sarif, schema); @@ -229,7 +229,7 @@ function validateSarifFileSchema(sarifFilePath, logger) { // Set the main error message to the stacks of all the errors. // This should be of a manageable size and may even give enough to fix the error. const sarifErrors = errors.map((e) => `- ${e.stack}`); - throw new InvalidRequestError(`Unable to upload "${sarifFilePath}" as it is not valid SARIF:\n${sarifErrors.join("\n")}`); + throw new InvalidSarifUploadError(`Unable to upload "${sarifFilePath}" as it is not valid SARIF:\n${sarifErrors.join("\n")}`); } } exports.validateSarifFileSchema = validateSarifFileSchema; @@ -366,7 +366,7 @@ async function waitForProcessing(repositoryNwo, sarifID, logger, options = { const message = `Code Scanning could not process the submitted SARIF file:\n${response.data.errors}`; throw shouldConsiderConfigurationError(response.data.errors) ? new util_1.ConfigurationError(message) - : new InvalidRequestError(message); + : new InvalidSarifUploadError(message); } else { util.assertNever(status); @@ -429,7 +429,7 @@ function validateUniqueCategory(sarif) { for (const [category, { id, tool }] of Object.entries(categories)) { const sentinelEnvVar = `CODEQL_UPLOAD_SARIF_${category}`; if (process.env[sentinelEnvVar]) { - throw new InvalidRequestError("Aborting upload: only one run of the codeql/analyze or codeql/upload-sarif actions is allowed per job per tool/category. " + + throw new InvalidSarifUploadError("Aborting upload: only one run of the codeql/analyze or codeql/upload-sarif actions is allowed per job per tool/category. " + "The easiest fix is to specify a unique value for the `category` input. If .runs[].automationDetails.id is specified " + "in the sarif file, that will take precedence over your configured `category`. " + `Category: (${id ? id : "none"}) Tool: (${tool ? tool : "none"})`); @@ -453,7 +453,7 @@ function sanitize(str) { /** * An error that occurred due to an invalid SARIF upload request. */ -class InvalidRequestError extends Error { +class InvalidSarifUploadError extends Error { constructor(message) { super(message); } diff --git a/lib/upload-lib.js.map b/lib/upload-lib.js.map index 4e7564400c..9a2bdb5e08 100644 --- a/lib/upload-lib.js.map +++ b/lib/upload-lib.js.map @@ -1 +1 @@ -{"version":3,"file":"upload-lib.js","sourceRoot":"","sources":["../src/upload-lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,gDAAwB;AAExB,oDAAsC;AAEtC,wDAA+B;AAC/B,uDAAyC;AAEzC,4DAA8C;AAC9C,kDAAoC;AACpC,+CAAuC;AACvC,6DAA+C;AAE/C,6CAAiE;AACjE,6CAA+B;AAC/B,iCAAkE;AAElE,MAAM,eAAe,GACnB,oFAAoF,CAAC;AACvF,MAAM,eAAe,GACnB,mEAAmE,CAAC;AAEtE,mEAAmE;AACnE,qDAAqD;AACrD,SAAS,iBAAiB,CAAC,UAAoB;IAC7C,MAAM,aAAa,GAAc;QAC/B,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;KACT,CAAC;IAEF,K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,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CACpE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAxBD,wDAwBC;AAED;;;;;;;;GAQG;AACH,SAAS,QAAQ,CAAC,GAAY;IAC5B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,mBAAoB,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"upload-lib.js","sourceRoot":"","sources":["../src/upload-lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,gDAAwB;AAExB,oDAAsC;AAEtC,wDAA+B;AAC/B,uDAAyC;AAEzC,4DAA8C;AAC9C,kDAAoC;AACpC,+CAAuC;AACvC,6DAA+C;AAE/C,6CAAiE;AACjE,6CAA+B;AAC/B,iCAAkE;AAElE,MAAM,eAAe,GACnB,oFAAoF,CAAC;AACvF,MAAM,eAAe,GACnB,mEAAmE,CAAC;AAEtE,mEAAmE;AACnE,qDAAqD;AACrD,SAAS,iBAAiB,CAAC,UAAoB;IAC7C,MAAM,aAAa,GAAc;QAC/B,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;KACT,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CACtB,CAAC;QACf,sBAAsB;QACtB,IAAI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c,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAxBD,wDAwBC;AAED;;;;;;;;GAQG;AACH,SAAS,QAAQ,CAAC,GAAY;IAC5B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,uBAAwB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF"} \ No newline at end of file diff --git a/src/upload-lib.ts b/src/upload-lib.ts index 3cb23cff6c..b5360fc4a4 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -37,7 +37,7 @@ function combineSarifFiles(sarifFiles: string[]): SarifFile { if (combinedSarif.version === null) { combinedSarif.version = sarifObject.version; } else if (combinedSarif.version !== sarifObject.version) { - throw new InvalidRequestError( + throw new InvalidSarifUploadError( `Different SARIF versions encountered: ${combinedSarif.version} and ${sarifObject.version}`, ); } @@ -207,7 +207,7 @@ export async function uploadFromActions( logger, ); } catch (e) { - if (e instanceof InvalidRequestError && isThirdPartyUpload) { + if (e instanceof InvalidSarifUploadError && isThirdPartyUpload) { throw new ConfigurationError(e.message); } throw e; @@ -216,14 +216,14 @@ export async function uploadFromActions( function getSarifFilePaths(sarifPath: string) { if (!fs.existsSync(sarifPath)) { - throw new InvalidRequestError(`Path does not exist: ${sarifPath}`); + throw new InvalidSarifUploadError(`Path does not exist: ${sarifPath}`); } let sarifFiles: string[]; if (fs.lstatSync(sarifPath).isDirectory()) { sarifFiles = findSarifFilesInDir(sarifPath); if (sarifFiles.length === 0) { - throw new InvalidRequestError( + throw new InvalidSarifUploadError( `No SARIF files found to upload in "${sarifPath}".`, ); } @@ -238,12 +238,12 @@ function countResultsInSarif(sarif: string): number { let numResults = 0; const parsedSarif = JSON.parse(sarif); if (!Array.isArray(parsedSarif.runs)) { - throw new InvalidRequestError("Invalid SARIF. Missing 'runs' array."); + throw new InvalidSarifUploadError("Invalid SARIF. Missing 'runs' array."); } for (const run of parsedSarif.runs) { if (!Array.isArray(run.results)) { - throw new InvalidRequestError( + throw new InvalidSarifUploadError( "Invalid SARIF. Missing 'results' array in run.", ); } @@ -259,7 +259,7 @@ export function validateSarifFileSchema(sarifFilePath: string, logger: Logger) { try { sarif = JSON.parse(fs.readFileSync(sarifFilePath, "utf8")) as SarifFile; } catch (e) { - throw new InvalidRequestError( + throw new InvalidSarifUploadError( `Invalid SARIF. JSON syntax error: ${wrapError(e).message}`, ); } @@ -292,7 +292,7 @@ export function validateSarifFileSchema(sarifFilePath: string, logger: Logger) { // Set the main error message to the stacks of all the errors. // This should be of a manageable size and may even give enough to fix the error. const sarifErrors = errors.map((e) => `- ${e.stack}`); - throw new InvalidRequestError( + throw new InvalidSarifUploadError( `Unable to upload "${sarifFilePath}" as it is not valid SARIF:\n${sarifErrors.join( "\n", )}`, @@ -511,7 +511,7 @@ export async function waitForProcessing( const message = `Code Scanning could not process the submitted SARIF file:\n${response.data.errors}`; throw shouldConsiderConfigurationError(response.data.errors as string[]) ? new ConfigurationError(message) - : new InvalidRequestError(message); + : new InvalidSarifUploadError(message); } else { util.assertNever(status); } @@ -588,7 +588,7 @@ export function validateUniqueCategory(sarif: SarifFile): void { for (const [category, { id, tool }] of Object.entries(categories)) { const sentinelEnvVar = `CODEQL_UPLOAD_SARIF_${category}`; if (process.env[sentinelEnvVar]) { - throw new InvalidRequestError( + throw new InvalidSarifUploadError( "Aborting upload: only one run of the codeql/analyze or codeql/upload-sarif actions is allowed per job per tool/category. " + "The easiest fix is to specify a unique value for the `category` input. If .runs[].automationDetails.id is specified " + "in the sarif file, that will take precedence over your configured `category`. " + @@ -615,7 +615,7 @@ function sanitize(str?: string) { /** * An error that occurred due to an invalid SARIF upload request. */ -class InvalidRequestError extends Error { +class InvalidSarifUploadError extends Error { constructor(message: string) { super(message); }