I am using the anchore/scan-action@v3 action to output a SARIF report but when it comes to uploading the report in the github/codeql-action/upload-sarif@v3 step, I get an error:
Error: Invalid SARIF. JSON syntax error: Unexpected end of JSON input
It seems like anchore/scan-action@v3 might be producing a bad SARIF file?
If there are changes that prevent you from upgrading, or if this still happens on the latest release, please let us know!
Also, we are in the process of releasing a minor version of v5 right now, so if you upgrade later today or tomorrow you’ll get a newer syft, grype, and scan-action than if you do it right this second.
I’d suggest getting an absolute path to the SBOM and using that in the Grype scan step, if possible. I believe, when you restore artifacts there they are output to a directory matching the name of the artifact, not in the working dir.
Also, it sure looks like Grype should be failing in this case, but I assume it isn’t failing because the fail-build: false is set and the action is only checking the exit code and failing when fail-build: true is set, and it is not validating that an appropriate output was even created. I’ve added an issue to scan-action to fail the build appropriately when configuration is incorrect / output does not succeed: Action continues on non-vulnerability failures · Issue #390 · anchore/scan-action · GitHub