Skip to content

Commit 6423033

Browse files
committed
JS: Resolve inserted TODOs
1 parent 102b187 commit 6423033

17 files changed

+105
-80
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ module BrokenCryptoAlgorithmConfig implements DataFlow::ConfigSig {
2626

2727
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
2828

29-
predicate observeDiffInformedIncrementalMode() {
30-
// TODO(diff-informed): Manually verify if config can be diff-informed.
31-
// ql/src/Security/CWE-327/BrokenCryptoAlgorithm.ql:27: Column 5 selects sink.getInitialization
32-
none()
29+
predicate observeDiffInformedIncrementalMode() { any() }
30+
31+
Location getASelectedSinkLocation(DataFlow::Node sink) {
32+
result = sink.(Sink).getLocation()
33+
or
34+
result = sink.(Sink).getInitialization().getLocation()
3335
}
3436
}
3537

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ module ClientSideRequestForgeryConfig implements DataFlow::ConfigSig {
3232
isAdditionalRequestForgeryStep(node1, node2)
3333
}
3434

35-
predicate observeDiffInformedIncrementalMode() {
36-
// TODO(diff-informed): Manually verify if config can be diff-informed.
37-
// ql/src/Security/CWE-918/ClientSideRequestForgery.ql:24: Column 1 selects sink.getARequest
38-
none()
35+
predicate observeDiffInformedIncrementalMode() { any() }
36+
37+
Location getASelectedSinkLocation(DataFlow::Node sink) {
38+
result = sink.(Sink).getLocation()
39+
or
40+
result = sink.(Sink).getARequest().getLocation()
3941
}
4042
}
4143

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ module CommandInjectionConfig implements DataFlow::ConfigSig {
3131

3232
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
3333

34-
predicate observeDiffInformedIncrementalMode() {
35-
// TODO(diff-informed): Manually verify if config can be diff-informed.
36-
// ql/src/Security/CWE-078/CommandInjection.ql:31: Column 1 does not select a source or sink originating from the flow call on line 24
37-
// ql/src/experimental/heuristics/ql/src/Security/CWE-078/CommandInjection.ql:34: Column 1 does not select a source or sink originating from the flow call on line 26
38-
none()
34+
predicate observeDiffInformedIncrementalMode() { any() }
35+
36+
Location getASelectedSinkLocation(DataFlow::Node sink) {
37+
exists(DataFlow::Node node |
38+
isSinkWithHighlight(sink, node) and
39+
result = node.getLocation()
40+
)
3941
}
4042
}
4143

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ module CorsMisconfigurationConfig implements DataFlow::ConfigSig {
2424
node = TaintTracking::AdHocWhitelistCheckSanitizer::getABarrierNode()
2525
}
2626

27-
predicate observeDiffInformedIncrementalMode() {
28-
// TODO(diff-informed): Manually verify if config can be diff-informed.
29-
// ql/src/Security/CWE-346/CorsMisconfigurationForCredentials.ql:22: Column 5 selects sink.getCredentialsHeader
30-
// ql/src/experimental/heuristics/ql/src/Security/CWE-346/CorsMisconfigurationForCredentials.ql:25: Column 5 selects sink.getCredentialsHeader
31-
none()
27+
predicate observeDiffInformedIncrementalMode() { any() }
28+
29+
Location getASelectedSinkLocation(DataFlow::Node sink) {
30+
result = sink.(Sink).getLocation()
31+
or
32+
result = sink.(Sink).getCredentialsHeader().getLocation()
3233
}
3334
}
3435

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ module DeepObjectResourceExhaustionConfig implements DataFlow::StateConfigSig {
3434
TaintedObject::isAdditionalFlowStep(node1, state1, node2, state2)
3535
}
3636

37-
predicate observeDiffInformedIncrementalMode() {
38-
// TODO(diff-informed): Manually verify if config can be diff-informed.
39-
// ql/src/Security/CWE-400/DeepObjectResourceExhaustion.ql:23: Column 7 does not select a source or sink originating from the flow call on line 19
40-
none()
37+
predicate observeDiffInformedIncrementalMode() { any() }
38+
39+
Location getASelectedSinkLocation(DataFlow::Node sink) {
40+
result = sink.(Sink).getLocation()
41+
or
42+
exists(DataFlow::Node link |
43+
sink.(Sink).hasReason(link, _) and
44+
result = link.getLocation()
45+
)
4146
}
4247
}
4348

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ module IndirectCommandInjectionConfig implements DataFlow::ConfigSig {
2727

2828
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
2929

30-
predicate observeDiffInformedIncrementalMode() {
31-
// TODO(diff-informed): Manually verify if config can be diff-informed.
32-
// ql/src/Security/CWE-078/IndirectCommandInjection.ql:29: Column 1 does not select a source or sink originating from the flow call on line 25
33-
none()
30+
predicate observeDiffInformedIncrementalMode() { any() }
31+
32+
Location getASelectedSinkLocation(DataFlow::Node sink) {
33+
exists(DataFlow::Node node |
34+
isSinkWithHighlight(sink, node) and
35+
result = node.getLocation()
36+
)
3437
}
3538
}
3639

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ module InsecureDownloadConfig implements DataFlow::StateConfigSig {
2424

2525
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
2626

27-
predicate observeDiffInformedIncrementalMode() {
28-
// TODO(diff-informed): Manually verify if config can be diff-informed.
29-
// ql/src/Security/CWE-829/InsecureDownload.ql:21: Column 5 selects sink.getDownloadCall
30-
none()
27+
predicate observeDiffInformedIncrementalMode() { any() }
28+
29+
Location getASelectedSinkLocation(DataFlow::Node sink) {
30+
result = sink.(Sink).getLocation()
31+
or
32+
result = sink.(Sink).getDownloadCall().getLocation()
3133
}
3234
}
3335

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,7 @@ module NosqlInjectionConfig implements DataFlow::StateConfigSig {
5252
state2 = state1
5353
}
5454

55-
predicate observeDiffInformedIncrementalMode() {
56-
// TODO(diff-informed): Manually verify if config can be diff-informed.
57-
// ql/src/Security/CWE-089/SqlInjection.ql:35: Column 1 does not select a source or sink originating from the flow call on line 32
58-
// ql/src/Security/CWE-089/SqlInjection.ql:35: Column 5 does not select a source or sink originating from the flow call on line 32
59-
// ql/src/experimental/heuristics/ql/src/Security/CWE-089/SqlInjection.ql:37: Column 1 does not select a source or sink originating from the flow call on line 34
60-
// ql/src/experimental/heuristics/ql/src/Security/CWE-089/SqlInjection.ql:37: Column 5 does not select a source or sink originating from the flow call on line 34
61-
none()
62-
}
55+
predicate observeDiffInformedIncrementalMode() { any() }
6356
}
6457

6558
/**

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ module PrototypePollutionConfig implements DataFlow::StateConfigSig {
4848
node = TaintedObject::SanitizerGuard::getABarrierNode(state)
4949
}
5050

51-
predicate observeDiffInformedIncrementalMode() {
52-
// TODO(diff-informed): Manually verify if config can be diff-informed.
53-
// ql/src/Security/CWE-915/PrototypePollutingMergeCall.ql:30: Column 7 does not select a source or sink originating from the flow call on line 26
54-
none()
51+
predicate observeDiffInformedIncrementalMode() { any() }
52+
53+
Location getASelectedSinkLocation(DataFlow::Node sink) {
54+
result = sink.(Sink).getLocation()
55+
or
56+
exists(Locatable loc |
57+
sink.(Sink).dependencyInfo(_, loc) and
58+
result = loc.getLocation()
59+
)
5560
}
5661
}
5762

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ module RequestForgeryConfig implements DataFlow::ConfigSig {
2727
isAdditionalRequestForgeryStep(node1, node2)
2828
}
2929

30-
predicate observeDiffInformedIncrementalMode() {
31-
// TODO(diff-informed): Manually verify if config can be diff-informed.
32-
// ql/src/Security/CWE-918/RequestForgery.ql:21: Column 1 selects sink.getARequest
33-
none()
30+
predicate observeDiffInformedIncrementalMode() { any() }
31+
32+
Location getASelectedSinkLocation(DataFlow::Node sink) {
33+
result = sink.(Sink).getLocation()
34+
or
35+
result = sink.(Sink).getARequest().getLocation()
3436
}
3537
}
3638

0 commit comments

Comments
 (0)