File tree Expand file tree Collapse file tree
powershell/ql/lib/semmle/code/powershell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -565,6 +565,22 @@ module ExprNodes {
565565
566566 final ExprCfgNode getAnOperand ( ) { e .hasCfgChild ( this .getExpr ( ) .getAnOperand ( ) , this , result ) }
567567 }
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+ }
568584}
569585
570586module StmtNodes {
Original file line number Diff line number Diff line change @@ -469,7 +469,9 @@ class CallNode extends AstNode {
469469
470470/** A call to operator `&`, viwed as a node in a data flow graph. */
471471class 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 ( ) }
473475}
474476
475477/** 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 {
3434 cached
3535 predicate defaultAdditionalTaintStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo , string model ) {
3636 (
37+ // Flow from an operand to an operation
3738 exists ( CfgNodes:: ExprNodes:: OperationCfgNode op |
3839 op = nodeTo .asExpr ( ) and
3940 op .getAnOperand ( ) = nodeFrom .asExpr ( )
4041 )
4142 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
4249 // Although flow through collections is modeled precisely using stores/reads, we still
4350 // allow flow out of a _tainted_ collection. This is needed in order to support taint-
4451 // tracking configurations where the source is a collection.
You can’t perform that action at this time.
0 commit comments