Skip to content

Commit 3e6629d

Browse files
author
Max Schaefer
committed
JavaScript: Deprecate multi-argument isBarrier and isSanitizer predicates.
We informally deprecated them in 1.21, this commit deprecates them properly and removes support from the implementation. The predicates themselves will be removed in a future release.
1 parent bf0201a commit 3e6629d

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

change-notes/1.22/analysis-javascript.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@
3131

3232
- The `getName()` predicate on functions and classes now gets a name
3333
inferred from the context if the function or class was not declared with a name.
34+
- The two-argument and three-argument variants of `DataFlow::Configuration::isBarrier` and
35+
`TaintTracking::Configuration::isSanitizer` have been deprecated. Overriding them no
36+
longer has any effect. Use `isBarrierEdge` and `isSanitizerEdge` instead.

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ abstract class Configuration extends string {
157157
*
158158
* Holds if flow from `src` to `trg` is prohibited.
159159
*/
160-
predicate isBarrier(DataFlow::Node src, DataFlow::Node trg) { none() }
160+
deprecated predicate isBarrier(DataFlow::Node src, DataFlow::Node trg) { none() }
161161

162162
/**
163163
* DEPRECATED: Use `isBarrierEdge` instead.
164164
*
165165
* Holds if flow with label `lbl` cannot flow from `src` to `trg`.
166166
*/
167-
predicate isBarrier(DataFlow::Node src, DataFlow::Node trg, FlowLabel lbl) { none() }
167+
deprecated predicate isBarrier(DataFlow::Node src, DataFlow::Node trg, FlowLabel lbl) { none() }
168168

169169
/**
170170
* Holds if flow from `pred` to `succ` is prohibited.
@@ -486,7 +486,6 @@ private predicate basicFlowStep(
486486
// Local flow
487487
exists(FlowLabel predlbl, FlowLabel succlbl |
488488
localFlowStep(pred, succ, cfg, predlbl, succlbl) and
489-
not cfg.isBarrier(pred, succ, predlbl) and
490489
not cfg.isBarrierEdge(pred, succ, predlbl) and
491490
summary = MkPathSummary(false, false, predlbl, succlbl)
492491
)
@@ -601,7 +600,6 @@ private predicate callInputStep(
601600
)
602601
) and
603602
not cfg.isBarrier(succ) and
604-
not cfg.isBarrier(pred, succ) and
605603
not cfg.isBarrierEdge(pred, succ)
606604
}
607605

@@ -656,7 +654,6 @@ private predicate flowThroughCall(
656654
ret.asExpr() = f.getAReturnedExpr() and
657655
calls(output, f) and // Do not consider partial calls
658656
reachableFromInput(f, output, input, ret, cfg, summary) and
659-
not cfg.isBarrier(ret, output) and
660657
not cfg.isBarrierEdge(ret, output) and
661658
not cfg.isLabeledBarrier(output, summary.getEndLabel())
662659
)
@@ -666,7 +663,6 @@ private predicate flowThroughCall(
666663
DataFlow::exceptionalInvocationReturnNode(output, invk.asExpr()) and
667664
calls(invk, f) and
668665
reachableFromInput(f, invk, input, ret, cfg, summary) and
669-
not cfg.isBarrier(ret, output) and
670666
not cfg.isBarrierEdge(ret, output) and
671667
not cfg.isLabeledBarrier(output, summary.getEndLabel())
672668
)
@@ -906,7 +902,6 @@ private predicate flowStep(
906902
flowIntoHigherOrderCall(pred, succ, cfg, summary)
907903
) and
908904
not cfg.isBarrier(succ) and
909-
not cfg.isBarrier(pred, succ) and
910905
not cfg.isBarrierEdge(pred, succ) and
911906
not cfg.isLabeledBarrier(succ, summary.getEndLabel())
912907
}

javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ module TaintTracking {
5656
*
5757
* Holds if the edge from `source` to `sink` is a taint sanitizer.
5858
*/
59-
predicate isSanitizer(DataFlow::Node source, DataFlow::Node sink) { none() }
59+
deprecated predicate isSanitizer(DataFlow::Node source, DataFlow::Node sink) { none() }
6060

6161
/**
6262
* DEPRECATED: Use `isSanitizerEdge` instead.
6363
*
6464
* Holds if the edge from `source` to `sink` is a taint sanitizer for data labelled with `lbl`.
6565
*/
66-
predicate isSanitizer(DataFlow::Node source, DataFlow::Node sink, DataFlow::FlowLabel lbl) {
66+
deprecated predicate isSanitizer(DataFlow::Node source, DataFlow::Node sink, DataFlow::FlowLabel lbl) {
6767
none()
6868
}
6969

@@ -92,15 +92,13 @@ module TaintTracking {
9292

9393
final override predicate isBarrierEdge(DataFlow::Node source, DataFlow::Node sink) {
9494
super.isBarrierEdge(source, sink) or
95-
isSanitizer(source, sink) or
9695
isSanitizerEdge(source, sink)
9796
}
9897

9998
final override predicate isBarrierEdge(
10099
DataFlow::Node source, DataFlow::Node sink, DataFlow::FlowLabel lbl
101100
) {
102101
super.isBarrierEdge(source, sink, lbl) or
103-
isSanitizer(source, sink, lbl) or
104102
isSanitizerEdge(source, sink, lbl)
105103
}
106104

0 commit comments

Comments
 (0)