Skip to content

Commit c7abd4c

Browse files
committed
JS: Remove the unused edge-sanitizer hook in UnvalidatedDynamicMethodCall
1 parent 1a395c5 commit c7abd4c

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/UnvalidatedDynamicMethodCallCustomizations.qll

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,24 @@ module UnvalidatedDynamicMethodCall {
3434

3535
/**
3636
* A sanitizer for unvalidated dynamic method calls.
37-
* Override the `sanitizes` predicate to specify an edge that should be sanitized.
38-
* The `this` value is not seen as a sanitizer.
3937
*/
4038
abstract class Sanitizer extends DataFlow::Node {
41-
abstract predicate sanitizes(DataFlow::Node source, DataFlow::Node sink, DataFlow::FlowLabel lbl);
39+
/**
40+
* Gets the flow label blocked by this sanitizer.
41+
*/
42+
DataFlow::FlowLabel getFlowLabel() { result.isTaint() }
43+
44+
/**
45+
* DEPRECATED. Use sanitizer nodes instead.
46+
*
47+
* This predicate no longer has any effect. The `this` value of `Sanitizer` is instead
48+
* treated as a sanitizing node, that is, flow in and out of that node is prohibited.
49+
*/
50+
deprecated predicate sanitizes(
51+
DataFlow::Node source, DataFlow::Node sink, DataFlow::FlowLabel lbl
52+
) {
53+
none()
54+
}
4255
}
4356

4457
/**

javascript/ql/lib/semmle/javascript/security/dataflow/UnvalidatedDynamicMethodCallQuery.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class Configuration extends TaintTracking::Configuration {
3838
sink.(Sink).getFlowLabel() = label
3939
}
4040

41-
override predicate isSanitizerEdge(
42-
DataFlow::Node pred, DataFlow::Node succ, DataFlow::FlowLabel lbl
43-
) {
44-
any(Sanitizer s).sanitizes(pred, succ, lbl)
41+
override predicate isLabeledBarrier(DataFlow::Node node, DataFlow::FlowLabel label) {
42+
super.isLabeledBarrier(node, label)
43+
or
44+
node.(Sanitizer).getFlowLabel() = label
4545
}
4646

4747
override predicate isSanitizerGuard(TaintTracking::SanitizerGuardNode guard) {

0 commit comments

Comments
 (0)