-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: Add TaintInheritingContent
#16063
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
Merged
MathiasVP
merged 7 commits into
github:main
from
MathiasVP:taint-inheriting-content-for-cpp
Mar 26, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2075716
C++: Add 'TaintInheritingContent'.
MathiasVP bd2ecd3
C++: Add test.
MathiasVP ec3d041
C++: Accept test changes.
MathiasVP e3744c4
C++: Add change note.
MathiasVP d610d72
C++: Add file QLDoc.
MathiasVP 6a8c592
Update cpp/ql/lib/semmle/code/cpp/ir/dataflow/FlowSteps.qll
MathiasVP 3bfaab9
C++: Remove debugging conjunct.
MathiasVP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
cpp/ql/lib/change-notes/2024-03-26-taint-inheriting-content.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: feature | ||
--- | ||
* Added a `TaintInheritingContent` class that can be extended to model taint flowing from a qualifier to a field. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* This file provides an abstract class that can be used to model additional | ||
* object-to-field taint-flow. | ||
*/ | ||
|
||
private import codeql.util.Unit | ||
private import semmle.code.cpp.dataflow.new.DataFlow | ||
|
||
/** | ||
* A `Content` that should be implicitly regarded as tainted whenever an object with such `Content` | ||
* is itself tainted. | ||
* | ||
* For example, if we had a type `struct Container { int field; }`, then by default a tainted | ||
* `Container` and a `Container` with a tainted `int` stored in its `field` are distinct. | ||
* | ||
* If `any(DataFlow::FieldContent fc | fc.getField().hasQualifiedName("Container", "field"))` was | ||
* included in this type however, then a tainted `Container` would imply that its `field` is also | ||
* tainted (but not vice versa). | ||
*/ | ||
abstract class TaintInheritingContent extends DataFlow::Content { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 would be nice if this comment expressed the intended direction, i.e. from qualifier to field in a read of
qualifier->field
.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.
That was indeed what I thought I was communicating with the
object->field
arrow. But if that's not clear I can make it more explicitThere 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.
I see what you mean, for me the word "conflation" suggests a two-way relationship (merging two things into one) which threw me off a bit - but the comment in the
TaintInheritingContent
class itself is completely clear.