Mark some more processing errors as invalid SARIF upload requests

This commit is contained in:
Henry Mercer 2024-03-20 20:55:54 +00:00
parent 294b6df61d
commit c84e4c8e7b
3 changed files with 13 additions and 6 deletions

5
lib/upload-lib.js generated
View file

@ -383,8 +383,9 @@ function shouldConsiderConfigurationError(processingErrors) {
* Returns whether the provided processing errors are the result of an invalid SARIF upload request.
*/
function shouldConsiderInvalidRequest(processingErrors) {
return (processingErrors.length === 1 &&
processingErrors[0].startsWith("rejecting SARIF,"));
return processingErrors.every((error) => error.startsWith("rejecting SARIF") ||
error.startsWith("could not convert rules: invalid security severity value, is not a number") ||
/^SARIF URI scheme [^\s]* did not match the checkout URI scheme [^\s]*/.test(error));
}
/**
* Checks the processing result for an unsuccessful execution. Throws if the

File diff suppressed because one or more lines are too long

View file

@ -530,9 +530,15 @@ function shouldConsiderConfigurationError(processingErrors: string[]): boolean {
* Returns whether the provided processing errors are the result of an invalid SARIF upload request.
*/
function shouldConsiderInvalidRequest(processingErrors: string[]): boolean {
return (
processingErrors.length === 1 &&
processingErrors[0].startsWith("rejecting SARIF,")
return processingErrors.every(
(error) =>
error.startsWith("rejecting SARIF") ||
error.startsWith(
"could not convert rules: invalid security severity value, is not a number",
) ||
/^SARIF URI scheme [^\s]* did not match the checkout URI scheme [^\s]*/.test(
error,
),
);
}