mirror of
https://github.com/github/codeql-action.git
synced 2025-12-31 19:50:32 +08:00
review-comments: remove syntax-error handling for SARIF from upload-lib
This commit is contained in:
@@ -433,7 +433,7 @@ test("shouldConsiderInvalidRequest returns correct recognises processing errors"
|
||||
|
||||
const error2 = [
|
||||
"locationFromSarifResult: expected artifact location",
|
||||
"SyntaxError: Unexpected end of JSON input",
|
||||
"an invalid URI was provided as a SARIF location",
|
||||
];
|
||||
t.true(uploadLib.shouldConsiderInvalidRequest(error2));
|
||||
|
||||
|
||||
@@ -759,7 +759,6 @@ export function shouldConsiderInvalidRequest(
|
||||
error.startsWith("rejecting SARIF") ||
|
||||
error.startsWith("an invalid URI was provided as a SARIF location") ||
|
||||
error.startsWith("locationFromSarifResult: expected artifact location") ||
|
||||
error.startsWith("SyntaxError: Unexpected end of JSON input") ||
|
||||
error.startsWith(
|
||||
"could not convert rules: invalid security severity value, is not a number",
|
||||
) ||
|
||||
|
||||
@@ -105,9 +105,15 @@ async function run() {
|
||||
await sendSuccessStatusReport(startedAt, uploadResult.statusReport, logger);
|
||||
} catch (unwrappedError) {
|
||||
const isThirdPartyAnalysis = !isFirstPartyAnalysis(ActionName.UploadSarif);
|
||||
// This is testing the error to check if it belongs to one of two categories we reliably
|
||||
// know to be configuration errors in certain cases.
|
||||
const configurationErrorCandidate =
|
||||
// There was a problem uploading the SARIF file (perhaps rejected by the backend)
|
||||
unwrappedError instanceof upload_lib.InvalidSarifUploadError ||
|
||||
// There was a problem validating the JSON (SARIF) file.
|
||||
unwrappedError instanceof SyntaxError;
|
||||
const error =
|
||||
isThirdPartyAnalysis &&
|
||||
unwrappedError instanceof upload_lib.InvalidSarifUploadError
|
||||
isThirdPartyAnalysis && configurationErrorCandidate
|
||||
? new ConfigurationError(unwrappedError.message)
|
||||
: wrapError(unwrappedError);
|
||||
const message = error.message;
|
||||
|
||||
Reference in New Issue
Block a user