File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
powershell/ql/lib/semmle/code/powershell Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,22 @@ module ExprNodes {
565
565
566
566
final ExprCfgNode getAnOperand ( ) { e .hasCfgChild ( this .getExpr ( ) .getAnOperand ( ) , this , result ) }
567
567
}
568
+
569
+ class ExpandableStringChildMappinig extends ExprChildMapping , ExpandableStringExpr {
570
+ override predicate relevantChild ( Ast n ) { n = this .getAnExpr ( ) }
571
+ }
572
+
573
+ class ExpandableStringCfgNode extends ExprCfgNode {
574
+ override string getAPrimaryQlClass ( ) { result = "ExpandableStringCfgNode" }
575
+
576
+ override ExpandableStringChildMappinig e ;
577
+
578
+ override ExpandableStringExpr getExpr ( ) { result = e }
579
+
580
+ ExprCfgNode getExpr ( int i ) { e .hasCfgChild ( e .getExpr ( i ) , this , result ) }
581
+
582
+ ExprCfgNode getAnExpr ( ) { result = this .getExpr ( _) }
583
+ }
568
584
}
569
585
570
586
module StmtNodes {
Original file line number Diff line number Diff line change @@ -469,7 +469,9 @@ class CallNode extends AstNode {
469
469
470
470
/** A call to operator `&`, viwed as a node in a data flow graph. */
471
471
class CallOperatorNode extends CallNode {
472
- CallOperatorNode ( ) { this .getCallNode ( ) instanceof CfgNodes:: StmtNodes:: CallOperatorCfgNode }
472
+ override CfgNodes:: StmtNodes:: CallOperatorCfgNode call ;
473
+
474
+ Node getCommand ( ) { result .asExpr ( ) = call .getCommand ( ) }
473
475
}
474
476
475
477
/** A use of a type name, viewed as a node in a data flow graph. */
Original file line number Diff line number Diff line change @@ -34,11 +34,18 @@ private module Cached {
34
34
cached
35
35
predicate defaultAdditionalTaintStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo , string model ) {
36
36
(
37
+ // Flow from an operand to an operation
37
38
exists ( CfgNodes:: ExprNodes:: OperationCfgNode op |
38
39
op = nodeTo .asExpr ( ) and
39
40
op .getAnOperand ( ) = nodeFrom .asExpr ( )
40
41
)
41
42
or
43
+ // Flow through string interpolation
44
+ exists ( CfgNodes:: ExprNodes:: ExpandableStringCfgNode es |
45
+ nodeFrom .asExpr ( ) = es .getAnExpr ( ) and
46
+ nodeTo .asExpr ( ) = es
47
+ )
48
+ or
42
49
// Although flow through collections is modeled precisely using stores/reads, we still
43
50
// allow flow out of a _tainted_ collection. This is needed in order to support taint-
44
51
// tracking configurations where the source is a collection.
You can’t perform that action at this time.
0 commit comments