Skip to content

Commit cd24ec8

Browse files
committed
Move the definition of isSource to the base class:
A long as we're not boosting sources, `isSource` is identical to `isKnownSource`.
1 parent 50291c7 commit cd24ec8

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/ATMConfig.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ abstract class AtmConfig extends JS::TaintTracking::Configuration {
3333
bindingset[this]
3434
AtmConfig() { any() }
3535

36+
/**
37+
* Holds if `source` is a relevant taint source. When sources are not boosted, `isSource` is equivalent to
38+
* `isKnownSource` (i.e there are no "effective" sources to be classified by an ML model).
39+
*/
40+
override predicate isSource(JS::DataFlow::Node source) { this.isKnownSource(source) }
41+
3642
/**
3743
* EXPERIMENTAL. This API may change in the future.
3844
*

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/NosqlInjectionATM.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class Configuration extends AtmConfig {
2525
* generalised to cover the sinks predicted by ATM.
2626
*/
2727

28-
override predicate isSource(DataFlow::Node source) { source instanceof NosqlInjection::Source }
29-
3028
override predicate isSource(DataFlow::Node source, DataFlow::FlowLabel label) {
3129
TaintedObject::isSource(source, label)
3230
}

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/SqlInjectionATM.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ class Configuration extends AtmConfig {
1616

1717
override EndpointType getASinkEndpointType() { result instanceof SqlInjectionSinkType }
1818

19-
/**
19+
/*
2020
* This is largely a copy of the taint tracking configuration for the standard SQL injection
2121
* query, except additional sinks have been added using the sink endpoint filter.
2222
*/
23-
override predicate isSource(DataFlow::Node source) { source instanceof SqlInjection::Source }
2423

2524
override predicate isSink(DataFlow::Node sink) {
2625
sink instanceof SqlInjection::Sink or isEffectiveSink(sink)

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/TaintedPathATM.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ class Configuration extends AtmConfig {
1616

1717
override EndpointType getASinkEndpointType() { result instanceof TaintedPathSinkType }
1818

19-
/**
19+
/*
2020
* This is largely a copy of the taint tracking configuration for the standard path injection
2121
* query, except additional ATM sinks have been added to the `isSink` predicate.
2222
*/
23-
override predicate isSource(DataFlow::Node source) { source instanceof TaintedPath::Source }
2423

2524
override predicate isSink(DataFlow::Node sink, DataFlow::FlowLabel label) {
2625
label = sink.(TaintedPath::Sink).getAFlowLabel()

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssATM.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* For internal use only.
33
*
4+
* A taint-tracking configuration for reasoning about XSS vulnerabilities.
45
* Defines shared code used by the XSS boosted query.
56
*/
67

@@ -15,13 +16,10 @@ class Configuration extends AtmConfig {
1516

1617
override EndpointType getASinkEndpointType() { result instanceof XssSinkType }
1718

18-
/**
19-
* A taint-tracking configuration for reasoning about XSS vulnerabilities.
20-
*
19+
/*
2120
* This is largely a copy of the taint tracking configuration for the standard XSSThroughDom query,
2221
* except additional ATM sinks have been added to the `isSink` predicate.
2322
*/
24-
override predicate isSource(DataFlow::Node source) { source instanceof DomBasedXss::Source }
2523

2624
override predicate isSink(DataFlow::Node sink) {
2725
sink instanceof DomBasedXss::Sink or

0 commit comments

Comments
 (0)