Skip to content

Commit a031904

Browse files
committed
JS: Use clearsContent from variable-capture output
1 parent f0e665d commit a031904

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

javascript/ql/lib/semmle/javascript/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,11 @@ predicate clearsContent(Node n, ContentSet c) {
16161616
VariableCaptureOutput::storeStep(getClosureNode(n), _, _) and
16171617
c = MkAnyCapturedContent()
16181618
or
1619+
exists(LocalVariableOrThis v |
1620+
VariableCaptureOutput::clearsContent(getClosureNode(n), v) and
1621+
c.asSingleton().asCapturedVariable() = v
1622+
)
1623+
or
16191624
// Block flow into the "window.location" property, as any assignment/mutation to this causes a page load and stops execution.
16201625
// The use of clearsContent here ensures we also block assignments like `window.location.href = ...`
16211626
exists(DataFlow::PropRef ref |

0 commit comments

Comments
 (0)