sast-scan
sast-scan copied to clipboard
Use uriBaseId to specify root for relative urls
For some tools that generate relative urls such as gitleaks, pmd the code auto-prefixes workspace for each result to make the location absolute. As per SARIF specification, it should be possible to specify uriBaseId
and retain relative urls.
https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/sarif-v2.1.0-cs01.html#_Toc16012377 - section 3.4.14
This should also improve performance by a few seconds since we dont have to do things like this.
https://github.com/AppThreat/sast-scan/blob/master/lib/convert.py#L261 https://github.com/AppThreat/sast-scan/blob/master/lib/xml_parser.py#L50
Example:
"originalUriBaseIds": {
"PROJECTROOT": {
"uri": "file://build.example.com/work/"
},
"SRCROOT": {
"uri": " src/",
"uriBaseId": "PROJECTROOT"
},
"BINROOT": {
"uri": " bin/",
"uriBaseId": "PROJECTROOT"
}
}