C++: Better InlineExpectation
tests for path-explanations
#7051
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.
While working on #6825 I discovered some problems with the tests in the
annotate_path_to_sink
directory.The tests in this folder are designed to give us a way to test the path explanations generated for dataflow queries by giving us the ability to annotate path components from ast or ir dataflow queries.
To construct the tainted elements in the path path, the test defines
tainted
roughly like this:this almost works: a tainted value is either a sink, or it's something that ends up in a sink. However, since the first argument of
DefaultTaintTracking::tainted
is restricted to being user input sources only, the second case only gives us the case wheretainted
is the source.This PR provides an attempt at fixing this (for the IR test only as the
security.TaintTracking
library doesn't have a concept of a path): We use theedges
predicate fromDefaultTaintTracking
(which again uses theedges
predicate from the shared dataflow library) to construct the path.In addition, I've also changed the annotations to distinguish whether the dataflow library considered a path component a sink or not - this is especially important now that we actually realize the whole path in the test.