-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Python: remove the imprecise container taint steps #17030
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
Draft
yoff
wants to merge
17
commits into
github:main
Choose a base branch
from
yoff:python/no-imprecise-container-step
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
34eaef7
Python: remove the imprecise container taint steps
yoff b82bcda
python: add read steps for some specific functions
yoff efad89a
Python: accept fixed FP
yoff e06386d
Python: allow taint from children to % format
yoff eb12b2d
Python: accept extra edges
yoff a340713
Python: NoSQL, allow implicit reads at sinks
yoff ee594f9
Python: more sweeping change regarding implicit reads
yoff ef10bcc
Python: use qldoc
yoff e7877e4
Python: taint test without implicit reads
yoff cc4f41b
Python: update test expectations
yoff c61a4d6
Python: more expectations
yoff 20dc6a6
Python: fix test and expectations
yoff 3669307
Python: update test with implicit read example
yoff 243f656
Python: update line numbers
yoff e158ccf
Python: more precise emulation of real tainttracking
yoff 046f890
Python: selective extra implicit reads [sketch]
yoff 00befa0
Python: make the decoder read step explicit
yoff 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
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
57 changes: 57 additions & 0 deletions
57
python/ql/test/experimental/meta/ProgressiveTaintTrackingTest.qll
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,57 @@ | ||
/** | ||
* Provides classes for testing local (intra-procedural) and | ||
* global (inter-procedural) taint-tracking analyses. | ||
* | ||
* This module intentionally turns off implicit read steps at sinks. | ||
* This makes it possible to do successive tests of taint propagation, | ||
* using sinks (such as arguments to `ensure_tainted`) as markers, and get a picture of where taint flows | ||
* on its way from a source to a sink. | ||
* | ||
* To use global (interprocedural) taint tracking, extend the class | ||
* `TaintTracking::Configuration` as documented on that class. To use local | ||
* (intraprocedural) taint tracking, call `TaintTracking::localTaint` or | ||
* `TaintTracking::localTaintStep` with arguments of type `DataFlow::Node`. | ||
*/ | ||
|
||
private import python | ||
|
||
/** | ||
* Provides classes for performing local (intra-procedural) and | ||
* global (inter-procedural) taint-tracking analyses. | ||
*/ | ||
module TaintTracking { | ||
import semmle.python.dataflow.new.internal.tainttracking1.TaintTrackingParameter::Public | ||
Check warningCode scanning / CodeQL Redundant import Warning test
Redundant import, the module is already imported inside
semmle.python.dataflow.new.internal.tainttracking1.TaintTrackingImpl Error loading related location Loading |
||
private import semmle.python.dataflow.new.internal.DataFlowImplSpecific | ||
private import codeql.dataflow.TaintTracking | ||
private import semmle.python.Files | ||
|
||
module PythonTaintTracking implements InputSig<Location, PythonDataFlow> { | ||
private import semmle.python.dataflow.new.internal.TaintTrackingPrivate as TP | ||
|
||
/** | ||
* Holds if `node` should be a sanitizer in all global taint flow configurations | ||
* but not in local taint. | ||
*/ | ||
predicate defaultTaintSanitizer(PythonDataFlow::Node node) { TP::defaultTaintSanitizer(node) } | ||
|
||
/** | ||
* Holds if default `TaintTracking::Configuration`s should allow implicit reads | ||
* of `c` at sinks and inputs to additional taint steps. | ||
*/ | ||
bindingset[node] | ||
predicate defaultImplicitTaintRead(PythonDataFlow::Node node, PythonDataFlow::ContentSet c) { | ||
// Normally, we allow implicit reads of precise content, | ||
// but for taint tests, we turn this off. | ||
none() | ||
} | ||
|
||
predicate defaultAdditionalTaintStep( | ||
PythonDataFlow::Node nodeFrom, PythonDataFlow::Node nodeTo, string model | ||
) { | ||
TP::defaultAdditionalTaintStep(nodeFrom, nodeTo, model) | ||
} | ||
} | ||
|
||
import TaintFlowMake<Location, PythonDataFlow, PythonTaintTracking> | ||
import semmle.python.dataflow.new.internal.tainttracking1.TaintTrackingImpl | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Class QLDoc style. Warning