Skip to content

Commit c20ce62

Browse files
committed
Ruby: Exclude SplatExpr from taint tracking
`SplatExpr`s are modelled using flow summaries, so there is no need to include them explicitly in `defaultAdditionalTaintStep`.
1 parent 966c6f1 commit c20ce62

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ private module Cached {
8686
exists(CfgNodes::ExprNodes::OperationCfgNode op |
8787
op = nodeTo.asExpr() and
8888
op.getAnOperand() = nodeFrom.asExpr() and
89-
not op.getExpr() instanceof AssignExpr
89+
not op.getExpr() =
90+
any(Expr e |
91+
e instanceof AssignExpr or
92+
e instanceof SplatExpr
93+
)
9094
)
9195
or
9296
// string interpolation of `nodeFrom` into `nodeTo`

ruby/ql/test/library-tests/dataflow/array-flow/array-flow.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ edges
1010
| array_flow.rb:2:10:2:20 | call to source : | array_flow.rb:2:9:2:20 | * ... : |
1111
| array_flow.rb:2:10:2:20 | call to source : | array_flow.rb:2:9:2:20 | * ... [array element 0] : |
1212
| array_flow.rb:2:10:2:20 | call to source : | array_flow.rb:2:9:2:20 | * ... [array element 0] : |
13-
| array_flow.rb:2:10:2:20 | call to source : | array_flow.rb:3:10:3:10 | a : |
14-
| array_flow.rb:2:10:2:20 | call to source : | array_flow.rb:4:10:4:10 | a : |
15-
| array_flow.rb:2:10:2:20 | call to source : | array_flow.rb:5:10:5:10 | a : |
1613
| array_flow.rb:3:10:3:10 | a : | array_flow.rb:3:10:3:13 | ...[...] |
1714
| array_flow.rb:3:10:3:10 | a [array element 0] : | array_flow.rb:3:10:3:13 | ...[...] |
1815
| array_flow.rb:3:10:3:10 | a [array element 0] : | array_flow.rb:3:10:3:13 | ...[...] |

0 commit comments

Comments
 (0)