[STAL-2643] Export taint analysis violations to SARIF #517
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notes
What problem are you trying to solve?
Violations from our Java taint analysis implementation are represented by a flow of taint from a source variable to a sink method (and thus it has multiple "code regions" associated with it). This is distinctly different than a "standard" static analysis violation, which only has one code region.
So while we can detect and flag taint flow violations within rules, we can't currently export the flows via SARIF.
What is your solution?
codeFlows in SARIF
This PR modifies our SARIF output to include a "codeFlows" field in an analysis result.
You can see example JSON output here.
JavaScript Violation API
As part of this, the
Violation
class constructor has been changed to allow for more permissive passing in of objects/parameters to be interpreted as code regions in violations.Before, a violation had to be created like
Now, the constructor accepts a string message and is variadic for the rest of the properties. All of the following now work (and are equivalent in terms of the resulting region):
Additionally, a
TaintFlow
can be passed in:Note that this doesn't affect the old stella
buildError
API.Small details:
Alternatives considered
What the reviewer should know