Skip to content

Commit c5184d3

Browse files
committed
Suggestion from code review:
Name the query configuration e.g. `NosqlInjectionATMConfig` rather than `Configuration`.
1 parent 6f807e9 commit c5184d3

File tree

10 files changed

+30
-29
lines changed

10 files changed

+30
-29
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ private import semmle.javascript.heuristics.SyntacticHeuristics
1010
private import semmle.javascript.security.dataflow.NosqlInjectionCustomizations
1111
import AdaptiveThreatModeling
1212

13-
class Configuration extends AtmConfig {
14-
Configuration() { this = "NosqlInjectionATMConfig" }
13+
class NosqlInjectionAtmConfig extends AtmConfig {
14+
NosqlInjectionAtmConfig() { this = "NosqlInjectionAtmConfig" }
1515

1616
override predicate isKnownSource(DataFlow::Node source) {
1717
source instanceof NosqlInjection::Source or TaintedObject::isSource(source, _)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import semmle.javascript.heuristics.SyntacticHeuristics
99
import semmle.javascript.security.dataflow.SqlInjectionCustomizations
1010
import AdaptiveThreatModeling
1111

12-
class Configuration extends AtmConfig {
13-
Configuration() { this = "SqlInjectionATMConfig" }
12+
class SqlInjectionAtmConfig extends AtmConfig {
13+
SqlInjectionAtmConfig() { this = "SqlInjectionAtmConfig" }
1414

1515
override predicate isKnownSource(DataFlow::Node source) { source instanceof SqlInjection::Source }
1616

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import semmle.javascript.heuristics.SyntacticHeuristics
99
import semmle.javascript.security.dataflow.TaintedPathCustomizations
1010
import AdaptiveThreatModeling
1111

12-
class Configuration extends AtmConfig {
13-
Configuration() { this = "TaintedPathATMConfig" }
12+
class TaintedPathAtmConfig extends AtmConfig {
13+
TaintedPathAtmConfig() { this = "TaintedPathAtmConfig" }
1414

1515
override predicate isKnownSource(DataFlow::Node source) { source instanceof TaintedPath::Source }
1616

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ private import semmle.javascript.heuristics.SyntacticHeuristics
99
private import semmle.javascript.security.dataflow.DomBasedXssCustomizations
1010
import AdaptiveThreatModeling
1111

12-
class Configuration extends AtmConfig {
13-
Configuration() { this = "DomBasedXssATMConfig" }
12+
class DomBasedXssAtmConfig extends AtmConfig {
13+
DomBasedXssAtmConfig() { this = "DomBasedXssAtmConfig" }
1414

1515
override predicate isKnownSource(DataFlow::Node source) { source instanceof DomBasedXss::Source }
1616

javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/DebugResultInclusion.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ private import experimental.adaptivethreatmodeling.XssATM as XssAtm
1919

2020
string getAReasonSinkExcluded(DataFlow::Node sinkCandidate, Query query) {
2121
query instanceof NosqlInjectionQuery and
22-
result = any(NosqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(sinkCandidate)
22+
result = any(NosqlInjectionAtm::NosqlInjectionAtmConfig cfg).getAReasonSinkExcluded(sinkCandidate)
2323
or
2424
query instanceof SqlInjectionQuery and
25-
result = any(SqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(sinkCandidate)
25+
result = any(SqlInjectionAtm::SqlInjectionAtmConfig cfg).getAReasonSinkExcluded(sinkCandidate)
2626
or
2727
query instanceof TaintedPathQuery and
28-
result = any(TaintedPathAtm::Configuration cfg).getAReasonSinkExcluded(sinkCandidate)
28+
result = any(TaintedPathAtm::TaintedPathAtmConfig cfg).getAReasonSinkExcluded(sinkCandidate)
2929
or
3030
query instanceof XssQuery and
31-
result = any(XssAtm::Configuration cfg).getAReasonSinkExcluded(sinkCandidate)
31+
result = any(XssAtm::DomBasedXssAtmConfig cfg).getAReasonSinkExcluded(sinkCandidate)
3232
}
3333

3434
pragma[inline]

javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/extraction/ExtractEndpointDataTraining.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,14 @@ query predicate reformattedTrainingEndpoints(
206206
* TODO: Delete this once we are no longer surfacing `hasFlowFromSource`.
207207
*/
208208
DataFlow::Configuration getDataFlowCfg(Query query) {
209-
query instanceof NosqlInjectionQuery and result instanceof NosqlInjectionAtm::Configuration
209+
query instanceof NosqlInjectionQuery and
210+
result instanceof NosqlInjectionAtm::NosqlInjectionAtmConfig
210211
or
211-
query instanceof SqlInjectionQuery and result instanceof SqlInjectionAtm::Configuration
212+
query instanceof SqlInjectionQuery and result instanceof SqlInjectionAtm::SqlInjectionAtmConfig
212213
or
213-
query instanceof TaintedPathQuery and result instanceof TaintedPathAtm::Configuration
214+
query instanceof TaintedPathQuery and result instanceof TaintedPathAtm::TaintedPathAtmConfig
214215
or
215-
query instanceof XssQuery and result instanceof XssAtm::Configuration
216+
query instanceof XssQuery and result instanceof XssAtm::DomBasedXssAtmConfig
216217
}
217218

218219
// TODO: Delete this once we are no longer surfacing `hasFlowFromSource`.

javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/extraction/ExtractEndpointMapping.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ from string queryName, AtmConfig c, EndpointType e
1414
where
1515
(
1616
queryName = "SqlInjection" and
17-
c instanceof SqlInjectionAtm::Configuration
17+
c instanceof SqlInjectionAtm::SqlInjectionAtmConfig
1818
or
1919
queryName = "NosqlInjection" and
20-
c instanceof NosqlInjectionAtm::Configuration
20+
c instanceof NosqlInjectionAtm::NosqlInjectionAtmConfig
2121
or
2222
queryName = "TaintedPath" and
23-
c instanceof TaintedPathAtm::Configuration
23+
c instanceof TaintedPathAtm::TaintedPathAtmConfig
2424
or
25-
queryName = "Xss" and c instanceof XssAtm::Configuration
25+
queryName = "Xss" and c instanceof XssAtm::DomBasedXssAtmConfig
2626
) and
2727
e = c.getASinkEndpointType()
2828
select queryName, e.getEncoding() as label

javascript/ql/experimental/adaptivethreatmodeling/test/endpoint_large_scale/EndpointFeatures.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ private import experimental.adaptivethreatmodeling.EndpointCharacteristics as En
1717

1818
query predicate tokenFeatures(DataFlow::Node endpoint, string featureName, string featureValue) {
1919
(
20-
not exists(any(NosqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(endpoint)) or
21-
not exists(any(SqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(endpoint)) or
22-
not exists(any(TaintedPathAtm::Configuration cfg).getAReasonSinkExcluded(endpoint)) or
23-
not exists(any(XssAtm::Configuration cfg).getAReasonSinkExcluded(endpoint)) or
20+
not exists(any(NosqlInjectionAtm::NosqlInjectionAtmConfig cfg).getAReasonSinkExcluded(endpoint)) or
21+
not exists(any(SqlInjectionAtm::SqlInjectionAtmConfig cfg).getAReasonSinkExcluded(endpoint)) or
22+
not exists(any(TaintedPathAtm::TaintedPathAtmConfig cfg).getAReasonSinkExcluded(endpoint)) or
23+
not exists(any(XssAtm::DomBasedXssAtmConfig cfg).getAReasonSinkExcluded(endpoint)) or
2424
any(EndpointCharacteristics::IsArgumentToModeledFunctionCharacteristic characteristic)
2525
.getEndpoints(endpoint)
2626
) and

javascript/ql/experimental/adaptivethreatmodeling/test/endpoint_large_scale/FilteredTruePositives.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ import experimental.adaptivethreatmodeling.XssATM as XssAtm
2323

2424
query predicate nosqlFilteredTruePositives(DataFlow::Node endpoint, string reason) {
2525
endpoint instanceof NosqlInjection::Sink and
26-
reason = any(NosqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(endpoint) and
26+
reason = any(NosqlInjectionAtm::NosqlInjectionAtmConfig cfg).getAReasonSinkExcluded(endpoint) and
2727
not reason = ["argument to modeled function", "modeled sink", "modeled database access"]
2828
}
2929

3030
query predicate sqlFilteredTruePositives(DataFlow::Node endpoint, string reason) {
3131
endpoint instanceof SqlInjection::Sink and
32-
reason = any(SqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(endpoint) and
32+
reason = any(SqlInjectionAtm::SqlInjectionAtmConfig cfg).getAReasonSinkExcluded(endpoint) and
3333
reason != "argument to modeled function"
3434
}
3535

3636
query predicate taintedPathFilteredTruePositives(DataFlow::Node endpoint, string reason) {
3737
endpoint instanceof TaintedPath::Sink and
38-
reason = any(TaintedPathAtm::Configuration cfg).getAReasonSinkExcluded(endpoint) and
38+
reason = any(TaintedPathAtm::TaintedPathAtmConfig cfg).getAReasonSinkExcluded(endpoint) and
3939
reason != "argument to modeled function"
4040
}
4141

4242
query predicate xssFilteredTruePositives(DataFlow::Node endpoint, string reason) {
4343
endpoint instanceof DomBasedXss::Sink and
44-
reason = any(XssAtm::Configuration cfg).getAReasonSinkExcluded(endpoint) and
44+
reason = any(XssAtm::DomBasedXssAtmConfig cfg).getAReasonSinkExcluded(endpoint) and
4545
reason != "argument to modeled function"
4646
}

javascript/ql/experimental/adaptivethreatmodeling/test/modeled_apis/nosql_endpoint_filter_ignores_modeled_apis.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import javascript
22
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
33

44
query predicate effectiveSinks(DataFlow::Node node) {
5-
not exists(any(NosqlInjectionAtm::Configuration cfg).getAReasonSinkExcluded(node))
5+
not exists(any(NosqlInjectionAtm::NosqlInjectionAtmConfig cfg).getAReasonSinkExcluded(node))
66
}

0 commit comments

Comments
 (0)