Skip to content

Conversation

@jbj
Copy link
Contributor

@jbj jbj commented Aug 16, 2019

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::Configuration2 to using TaintTracking2::Configuration like 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.

@jbj jbj requested review from aschackmull and hvitved August 16, 2019 11:32
@jbj jbj requested review from a team as code owners August 16, 2019 11:32
Copy link
Contributor

@hvitved hvitved left a 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
Copy link
Contributor

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)?

Copy link
Contributor Author

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.

@jbj jbj force-pushed the pyrameterized-taint branch from 9085efe to d2eea3e Compare August 16, 2019 12:28
@jbj
Copy link
Contributor Author

jbj commented Aug 16, 2019

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be dataflow2, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

hvitved
hvitved previously approved these changes Aug 19, 2019
@jbj
Copy link
Contributor Author

jbj commented Aug 19, 2019

Fixing the DataFlow2 bug that Tom found revealed that TaintTrackingParameter.qll has to do a little more work: it has to rename DataFlow2 to DataFlow in the scope of tainttracking2/TaintTrackingImpl.qll. I added that in commit no. 3.

@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)?

@aschackmull
Copy link
Contributor

@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.

aschackmull
aschackmull previously approved these changes Aug 20, 2019
jbj added 8 commits August 20, 2019 13:45
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.
@jbj jbj force-pushed the pyrameterized-taint branch from e9c7f06 to bc702de Compare August 20, 2019 11:46
@jbj
Copy link
Contributor Author

jbj commented Aug 20, 2019

I now also made the change for C# and added change notes. I rebased the PR to avoid a change note conflict.

Copy link
Contributor

@hvitved hvitved left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants