-
Notifications
You must be signed in to change notification settings - Fork 738
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
SARIF reports generate broken artifact URIs when nonstandard path is used #1889
Comments
At first I thought this was simple, but... it's not. Let's see if we can work through this. The standard says
Well, right now Brakeman blindly copies the examples and sets It seems clear to me from section 3.14.14 that the combination of the
With that in mind, it seems like you are asking not for absolute URIs, but URIs relative to the directory from which Brakeman is run but are prepended by the specified After typing all that, I looked at https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#relative-uri-guidance-for-sarif-producers and it seems generating a proper Relevant bit: "originalUriBaseIds": {
"PROJECTROOT": {
"uri": "file:///C:/Users/Mary/code/TheProject/",
"description": {
"text": "The root directory for all project files."
}
},
"%SRCROOT%": {
"uri": "src/",
"uriBaseId": "PROJECTROOT",
"description": {
"text": "The root of the source tree."
}
}
} So I guess I'll add that. |
If you can try out #1890 that would be very helpful. |
Background
Brakeman version: 6.2.2
Issue
Brakeman's SARIF reporting only ever uses the relative path of artifacts, which you can see here. However, It never incorporates the
--path
option that was passed into the Brakeman scan.I discovered this when trying to run Brakeman on a mono-repo that contains several Rails apps. In order to scan a particular app in that repo, you need to specify the path of the specific Rails app you want to scan:
However, then the artifact URIs in the SARIF report are all relative and do not factor in the
--path
value, so the URIs look like:when they should look like:
This means you cannot have a full URI that indicates which app in the mono-repo is being scanned. This makes Brakeman artifacts break when importing its SARIF output into other scanners like GitHub's Advanced Security CodeQL scans, as GitHub is unable to generate artifacts for relative paths in a mono-repo when it cannot tell which app is being scanned.
The text was updated successfully, but these errors were encountered: