Skip to content

Commit 46e16b8

Browse files
committed
Refactor experimental queries to use ThreadModelFlowSource
1 parent cfd5f53 commit 46e16b8

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

go/ql/src/experimental/CWE-090/LDAPInjection.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,29 @@ private class LdapClientDNSink extends LdapSink {
9898
/**
9999
* DEPRECATED: Use `LdapInjectionFlow` instead.
100100
*
101-
* A taint-tracking configuration for reasoning about when a `RemoteFlowSource`
101+
* A taint-tracking configuration for reasoning about when a `ThreatModelFlowSource`
102102
* flows into an argument or field that is vulnerable to LDAP injection.
103103
*/
104104
deprecated class LdapInjectionConfiguration extends TaintTracking::Configuration {
105105
LdapInjectionConfiguration() { this = "Ldap injection" }
106106

107-
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
107+
override predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
108108

109109
override predicate isSink(DataFlow::Node sink) { sink instanceof LdapSink }
110110

111111
override predicate isSanitizer(DataFlow::Node sanitizer) { sanitizer instanceof LdapSanitizer }
112112
}
113113

114114
private module LdapInjectionConfig implements DataFlow::ConfigSig {
115-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
115+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
116116

117117
predicate isSink(DataFlow::Node sink) { sink instanceof LdapSink }
118118

119119
predicate isBarrier(DataFlow::Node node) { node instanceof LdapSanitizer }
120120
}
121121

122122
/**
123-
* Tracks taint flow for reasoning about when a `RemoteFlowSource` flows
123+
* Tracks taint flow for reasoning about when a `ThreatModelFlowSource` flows
124124
* into an argument or field that is vulnerable to LDAP injection.
125125
*/
126126
module LdapInjectionFlow = TaintTracking::Global<LdapInjectionConfig>;

go/ql/src/experimental/CWE-203/Timing.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private class SensitiveStringSink extends Sink {
9898

9999
module Config implements DataFlow::ConfigSig {
100100
predicate isSource(DataFlow::Node source) {
101-
source instanceof RemoteFlowSource and not isBadResult(source)
101+
source instanceof ThreatModelFlowSource and not isBadResult(source)
102102
}
103103

104104
predicate isSink(DataFlow::Node sink) { sink instanceof Sink and not isBadResult(sink) }

go/ql/src/experimental/CWE-287/ImproperLdapAuthCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module ImproperLdapAuth {
6868

6969
private module Config implements DataFlow::ConfigSig {
7070
predicate isSource(DataFlow::Node source) {
71-
source instanceof RemoteFlowSource or source instanceof EmptyString
71+
source instanceof ThreatModelFlowSource or source instanceof EmptyString
7272
}
7373

7474
predicate isSink(DataFlow::Node sink) { sink instanceof LdapAuthSink }

go/ql/src/experimental/CWE-369/DivideByZero.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ predicate divideByZeroSanitizerGuard(DataFlow::Node g, Expr e, boolean branch) {
2828
}
2929

3030
module Config implements DataFlow::ConfigSig {
31-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
31+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
3232

3333
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
3434
exists(Function f, DataFlow::CallNode cn | cn = f.getACall() |

go/ql/src/experimental/CWE-74/DsnInjection.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import DsnInjectionCustomizations
1414
import DsnInjectionFlow::PathGraph
1515

1616
/** A remote flow source taken as a source for the `DsnInjection` taint-flow configuration. */
17-
private class RemoteFlowAsSource extends Source instanceof RemoteFlowSource { }
17+
private class ThreatModelFlowAsSource extends Source instanceof ThreatModelFlowSource { }
1818

1919
from DsnInjectionFlow::PathNode source, DsnInjectionFlow::PathNode sink
2020
where DsnInjectionFlow::flowPath(source, sink)

go/ql/src/experimental/CWE-79/HTMLTemplateEscapingPassthrough.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PassthroughTypeName extends string {
3636
}
3737

3838
module UntrustedToPassthroughTypeConversionConfig implements DataFlow::ConfigSig {
39-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
39+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
4040

4141
additional predicate isSinkToPassthroughType(DataFlow::TypeCastNode sink, PassthroughTypeName name) {
4242
exists(Type typ |
@@ -53,7 +53,7 @@ module UntrustedToPassthroughTypeConversionConfig implements DataFlow::ConfigSig
5353
}
5454

5555
/**
56-
* Tracks taint flow for reasoning about when a `RemoteFlowSource` is
56+
* Tracks taint flow for reasoning about when a `ThreatModelFlowSource` is
5757
* converted into a special "passthrough" type which will not be escaped by the
5858
* template generator; this allows the injection of arbitrary content (html,
5959
* css, js) into the generated output of the templates.
@@ -109,13 +109,13 @@ predicate isSinkToTemplateExec(DataFlow::Node sink, DataFlow::CallNode call) {
109109
}
110110

111111
module FromUntrustedToTemplateExecutionCallConfig implements DataFlow::ConfigSig {
112-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
112+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
113113

114114
predicate isSink(DataFlow::Node sink) { isSinkToTemplateExec(sink, _) }
115115
}
116116

117117
/**
118-
* Tracks taint flow from a `RemoteFlowSource` into a template executor
118+
* Tracks taint flow from a `ThreatModelFlowSource` into a template executor
119119
* call.
120120
*/
121121
module FromUntrustedToTemplateExecutionCallFlow =

go/ql/src/experimental/CWE-807/SensitiveConditionBypass.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ deprecated class Configuration extends TaintTracking::Configuration {
5252
Configuration() { this = "Condtional Expression Check Bypass" }
5353

5454
override predicate isSource(DataFlow::Node source) {
55-
source instanceof RemoteFlowSource
55+
source instanceof ThreatModelFlowSource
5656
or
5757
exists(DataFlow::FieldReadNode f |
5858
f.getField().hasQualifiedName("net/http", "Request", "Host")
@@ -71,7 +71,7 @@ deprecated class Configuration extends TaintTracking::Configuration {
7171

7272
private module Config implements DataFlow::ConfigSig {
7373
predicate isSource(DataFlow::Node source) {
74-
source instanceof RemoteFlowSource
74+
source instanceof ThreatModelFlowSource
7575
or
7676
exists(DataFlow::FieldReadNode f |
7777
f.getField().hasQualifiedName("net/http", "Request", "Host")

go/ql/src/experimental/CWE-840/ConditionalBypass.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import go
1414

1515
module Config implements DataFlow::ConfigSig {
1616
predicate isSource(DataFlow::Node source) {
17-
source instanceof RemoteFlowSource
17+
source instanceof ThreatModelFlowSource
1818
or
1919
source = any(Field f | f.hasQualifiedName("net/http", "Request", "Host")).getARead()
2020
}

go/ql/src/experimental/CWE-918/SSRF.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ module ServerSideRequestForgery {
8888
abstract class SanitizerEdge extends DataFlow::Node { }
8989

9090
/**
91-
* DEPRECATED: Use `RemoteFlowSource` or `Source` instead.
91+
* DEPRECATED: Use `ThreatModelFlowSource` or `Source` instead.
9292
*/
93-
deprecated class UntrustedFlowAsSource = RemoteFlowAsSource;
93+
deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource;
9494

9595
/**
9696
* An user controlled input, considered as a flow source for request forgery.
9797
*/
98-
private class RemoteFlowAsSource extends Source instanceof RemoteFlowSource { }
98+
private class ThreatModelFlowAsSource extends Source instanceof ThreatModelFlowSource { }
9999

100100
/**
101101
* The URL of an HTTP request, viewed as a sink for request forgery.

go/ql/src/experimental/CWE-942/CorsMisconfiguration.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class AllowCredentialsHeaderWrite extends Http::HeaderWrite {
5252
}
5353

5454
module UntrustedToAllowOriginHeaderConfig implements DataFlow::ConfigSig {
55-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
55+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
5656

5757
additional predicate isSinkHW(DataFlow::Node sink, AllowOriginHeaderWrite hw) {
5858
sink = hw.getValue()
@@ -70,21 +70,21 @@ module UntrustedToAllowOriginHeaderConfig implements DataFlow::ConfigSig {
7070
}
7171

7272
module UntrustedToAllowOriginConfigConfig implements DataFlow::ConfigSig {
73-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
73+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
7474

7575
additional predicate isSinkWrite(DataFlow::Node sink, GinCors::AllowOriginsWrite w) { sink = w }
7676

7777
predicate isSink(DataFlow::Node sink) { isSinkWrite(sink, _) }
7878
}
7979

8080
/**
81-
* Tracks taint flowfor reasoning about when a `RemoteFlowSource` flows to
81+
* Tracks taint flowfor reasoning about when a `ThreatModelFlowSource` flows to
8282
* a `HeaderWrite` that writes an `Access-Control-Allow-Origin` header's value.
8383
*/
8484
module UntrustedToAllowOriginHeaderFlow = TaintTracking::Global<UntrustedToAllowOriginHeaderConfig>;
8585

8686
/**
87-
* Tracks taint flowfor reasoning about when a `RemoteFlowSource` flows to
87+
* Tracks taint flowfor reasoning about when a `ThreatModelFlowSource` flows to
8888
* a `AllowOriginsWrite` that writes an `Access-Control-Allow-Origin` header's value.
8989
*/
9090
module UntrustedToAllowOriginConfigFlow = TaintTracking::Global<UntrustedToAllowOriginConfigConfig>;
@@ -121,7 +121,7 @@ predicate allowCredentialsIsSetToTrue(DataFlow::ExprNode allowOriginHW) {
121121

122122
/**
123123
* Holds if the provided `allowOriginHW` HeaderWrite's value is set using an
124-
* RemoteFlowSource.
124+
* ThreatModelFlowSource.
125125
* The `message` parameter is populated with the warning message to be returned by the query.
126126
*/
127127
predicate flowsFromUntrustedToAllowOrigin(DataFlow::ExprNode allowOriginHW, string message) {
@@ -169,7 +169,7 @@ class MapRead extends DataFlow::ElementReadNode {
169169
}
170170

171171
module FromUntrustedConfig implements DataFlow::ConfigSig {
172-
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
172+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource }
173173

174174
predicate isSink(DataFlow::Node sink) { isSinkCgn(sink, _) }
175175

@@ -208,13 +208,13 @@ module FromUntrustedConfig implements DataFlow::ConfigSig {
208208
}
209209

210210
/**
211-
* Tracks taint flow for reasoning about when a `RemoteFlowSource` flows
211+
* Tracks taint flow for reasoning about when a `ThreatModelFlowSource` flows
212212
* somewhere.
213213
*/
214214
module FromUntrustedFlow = TaintTracking::Global<FromUntrustedConfig>;
215215

216216
/**
217-
* Holds if the provided `allowOriginHW` is also destination of a `RemoteFlowSource`.
217+
* Holds if the provided `allowOriginHW` is also destination of a `ThreatModelFlowSource`.
218218
*/
219219
predicate flowsToGuardedByCheckOnUntrusted(DataFlow::ExprNode allowOriginHW) {
220220
exists(DataFlow::Node sink, ControlFlow::ConditionGuardNode cgn |

0 commit comments

Comments
 (0)