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

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,
),
);
}