-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codeql-action/upload-sarif@v1 doesn't accept empty sarif #390
Comments
Detect if issues were found and upload SARIF report only in that case, because reports without entries are not accepted. See github/codeql-action#390. The analyzer is run twice in order to get a SARIF report as well as an exit status when issues are detected, as the scan-build --status-bugs parameter doesn't work when the output format is SARIF.
Detect if issues were found and upload SARIF report only in that case, because reports without entries are not accepted. See github/codeql-action#390. The analyzer is run twice in order to get a SARIF report as well as an exit status when issues are detected, as the scan-build --status-bugs parameter doesn't work when the output format is SARIF.
Detect if issues were found and upload SARIF report only in that case, because reports without entries are not accepted. See github/codeql-action#390. The analyzer is run twice in order to get a SARIF report as well as an exit status when issues are detected, as the scan-build --status-bugs parameter doesn't work when the output format is SARIF.
Detect if issues were found and upload SARIF report only in that case, because reports without entries are not accepted. See github/codeql-action#390. The analyzer is run twice in order to get a SARIF report as well as an exit status when issues are detected, as the scan-build --status-bugs parameter doesn't work when the output format is SARIF.
Detect if issues were found and upload SARIF report only in that case, because reports without entries are not accepted. See github/codeql-action#390. The analyzer is run twice in order to get a SARIF report as well as an exit status when issues are detected, as the scan-build --status-bugs parameter doesn't work when the output format is SARIF.
I'm uploading results from clang scan-build and seeing this also when no issues are detected. As a workaround the report is only uploaded if issues were found however I suspect this would mean that fixed issues may never get flagged as closed if there are no more issues. |
You're right that not uploading when there are no alerts will lead to alerts being left open erroneously. Code scanning decides that an alert is closed when a SARIF file is uploaded for that tool and ref that doesn't contain the alert. I would consider what does it mean to upload an empty SARIF file. It means that you ran zero code scanning tools. If you ran a tool and it found zero alerts then there should be an entry in the I think the real problem here lies with clang or the other tools that's generating a SARIF file with an empty |
Thanks, that makes sense. Note that I am also using sarif-multitool to convert clang individual files to a merged report. Clang produces one report per analyzed file that looks like this if there are no alerts:
Running sarif-multitool merge on those files produces:
so it appears information is lost. Perhaps this is an issue with the sarif-mutiltool, there are some bug reports that could be related. The reason I am merging clang reports is that when these were uploaded using codeql-action/upload-sarif@v1, unfixed alerts would get randomly closed and reappear on the Github Security tab between runs. Merging the reports made them appear consistently. Is there a problem with the sarif output from clang? Here's an example where an alert was found:
I'll open a new issue for this once it's clear where the problem is. |
Bugs@microsoft/sarif-multitoolI've opened the above bug. It's very clear that the merge agent is buggy. Whether there are other bugs is subject to discussion. github/codeqlFrom my perspective, there's a bug in github/codeql as well.
Is not remotely human friendly. If you (=codeql team) require that there be at least one github/codeql-actionAlso note that while the codeql backend should provide a friendly error akin to the above, this codeql-action should be able to preprocess, detect the same error and report it without hitting the codeql endpoint (saving everyone X api calls from their github api call quota). It's ok for rare edge cases not to be handled in wrappers like this, but this is not going to be a rare edge case. Especially when a major vendor (👋 Microsoft) is generating bogus outputs of this form and you're actively encouraging people to use your tool. |
Expected behaviour:
No error
Actual behaviour:
codeql-action/upload-sarif@v1 doesn't accept empty sarif
Exemple:
Result:
The sarif file was generated by github/codeql-action/analyze@v1 and sarif-multitool.
The text was updated successfully, but these errors were encountered: