Skip to content

Commit d0febd7

Browse files
committed
PS: Add taint flow through all operations.
1 parent cd017db commit d0febd7

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

powershell/ql/lib/semmle/code/powershell/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,22 @@ private module Cached {
3333
*/
3434
cached
3535
predicate defaultAdditionalTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo, string model) {
36-
// Although flow through collections is modeled precisely using stores/reads, we still
37-
// allow flow out of a _tainted_ collection. This is needed in order to support taint-
38-
// tracking configurations where the source is a collection.
39-
exists(DataFlow::ContentSet c | readStep(nodeFrom, c, nodeTo) |
40-
c.isSingleton(any(DataFlow::Content::ElementContent ec))
36+
(
37+
exists(CfgNodes::ExprNodes::OperationCfgNode op |
38+
op = nodeTo.asExpr() and
39+
op.getAnOperand() = nodeFrom.asExpr()
40+
)
4141
or
42-
c.isKnownOrUnknownElement(_)
43-
// or
44-
// TODO: We do't generate this one from readSteps yet, but we will as
45-
// soon as we start on models-as-data.
46-
// c.isAnyElement()
42+
// Although flow through collections is modeled precisely using stores/reads, we still
43+
// allow flow out of a _tainted_ collection. This is needed in order to support taint-
44+
// tracking configurations where the source is a collection.
45+
exists(DataFlow::ContentSet c | readStep(nodeFrom, c, nodeTo) |
46+
c.isSingleton(any(DataFlow::Content::ElementContent ec))
47+
or
48+
c.isKnownOrUnknownElement(_)
49+
or
50+
c.isAnyElement()
51+
)
4752
) and
4853
model = ""
4954
}

0 commit comments

Comments
 (0)