-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C++: Use pyrameterized modules for TaintTracking #1757
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
Conversation
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one question.
| * 100` since we consider a single bit of information to be too little. | ||
| */ | ||
| module TaintTracking2 { | ||
| import semmle.code.cpp.dataflow.internal.TaintTrackingUtil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this import happen in dataflow2/TaintTrackingImpl.qll (and same for TaintTracking.qll)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably should. That would be consistent with how we do it for DataFlow. I'll change that.
9085efe to
d2eea3e
Compare
|
I simplified this PR vastly after talking to @aschackmull. I dropped the commit that changed the data-flow libraries, so this PR now only changes the C/C++ taint tracking library. That means fewer code changes and fewer confusing indirections. |
| @@ -0,0 +1,2 @@ | |||
| import semmle.code.cpp.dataflow.DataFlow as Private | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be dataflow2, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
Fixing the @aschackmull, are you happy enough with these changes that I should apply the same restructuring to Java (and make the taint tracking implementation files identical across languages)? |
Yes. |
This explanation, taken from C/C++, was not correct for Java.
To keep the code changes minimal, and to keep the implementation similar
to C++ and Java, the `TaintTracking{Public,Private}` files are now
imported together through `TaintTrackingUtil`. This has the side effect
of exposing `localAdditionalTaintStep`. The corresponding predicate for
Java was already exposed.
e9c7f06 to
bc702de
Compare
|
I now also made the change for C# and added change notes. I rebased the PR to avoid a change note conflict. |
csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTrackingParameter.qll
Show resolved
Hide resolved
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C# changes LGTM. Thanks for taking on this task, @jbj.
This is a minimal PR to demonstrate how taint tracking can be pyrameterized such that each copy of the taint-tracking configuration class is byte-for-byte identical. It also switches the C++ interface from using
TaintTracking::Configuration2to usingTaintTracking2::Configurationlike C# does it.The commits should make sense individually: the first commit rearranges the data flow library, and the second commit makes the actual change to C++ taint tracking.
I didn't go as far as unifying the taint-tracking configuration classes across languages. I can follow up with language-specific PRs for that if we merge this PR.