Skip to content

Commit b7dfa23

Browse files
committed
Put QLDoc on data flow and taint tracking modules
We preserve all old QLDocs, but move them from the config to the Flow module. This makes more sense than the Config module, which is often private, and is generally not directly accessed.
1 parent 08e1e8a commit b7dfa23

40 files changed

+176
-53
lines changed

go/ql/lib/semmle/go/StringOps.qll

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@ module StringOps {
222222
}
223223
}
224224

225-
/**
226-
* A configuration for tracking flow from a call to `strings.NewReplacer` to
227-
* the receiver of a call to `strings.Replacer.Replace` or
228-
* `strings.Replacer.WriteString`.
229-
*/
230225
private module StringsNewReplacerConfig implements DataFlow::ConfigSig {
231226
predicate isSource(DataFlow::Node source) { source instanceof StringsNewReplacerCall }
232227

@@ -238,6 +233,10 @@ module StringOps {
238233
}
239234
}
240235

236+
/**
237+
* Tracks data flow from a call to `strings.NewReplacer` to the receiver of
238+
* a call to `strings.Replacer.Replace` or `strings.Replacer.WriteString`.
239+
*/
241240
private module StringsNewReplacerFlow = DataFlow::Global<StringsNewReplacerConfig>;
242241

243242
/**

go/ql/lib/semmle/go/security/AllocationSizeOverflow.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module AllocationSizeOverflow {
1414
import AllocationSizeOverflowCustomizations::AllocationSizeOverflow
1515

1616
/**
17-
* DEPRECATED: Use a copy of `FindLargeLensConfig` and `FindLargeLensFlow` instead.
17+
* DEPRECATED: Use copies of `FindLargeLensConfig` and `FindLargeLensFlow` instead.
1818
*
1919
* A taint-tracking configuration for identifying `len(...)` calls whose argument may be large.
2020
*/
@@ -40,6 +40,9 @@ module AllocationSizeOverflow {
4040
predicate isBarrier(DataFlow::Node nd) { nd instanceof Sanitizer }
4141
}
4242

43+
/**
44+
* Tracks taint flow to find `len(...)` calls whose argument may be large.
45+
*/
4346
private module FindLargeLensFlow = TaintTracking::Global<FindLargeLensConfig>;
4447

4548
private DataFlow::CallNode getALargeLenCall() {
@@ -111,5 +114,6 @@ module AllocationSizeOverflow {
111114
}
112115
}
113116

117+
/** Tracks taint flow to find allocation-size overflows. */
114118
module Flow = TaintTracking::Global<Config>;
115119
}

go/ql/lib/semmle/go/security/CleartextLogging.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,12 @@ module CleartextLogging {
8989
}
9090
}
9191

92+
/**
93+
* Tracks data flow for reasoning about clear-text logging of sensitive
94+
* information, from `Source`s, which are sources of sensitive data, to
95+
* `Sink`s, which is an abstract class representing all the places sensitive
96+
* data may be stored in cleartext. Additional sources or sinks can be added
97+
* by extending the relevant class.
98+
*/
9299
module Flow = DataFlow::Global<Config>;
93100
}

go/ql/lib/semmle/go/security/CommandInjection.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ module CommandInjection {
5151
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
5252
}
5353

54+
/**
55+
* Tracks taint flow for reasoning about command-injection vulnerabilities
56+
* with sinks which are not sanitized by `--`.
57+
*/
5458
module Flow = TaintTracking::Global<Config>;
5559

5660
private class ArgumentArrayWithDoubleDash extends DataFlow::Node {
@@ -129,5 +133,9 @@ module CommandInjection {
129133
}
130134
}
131135

136+
/**
137+
* Tracks taint flow for reasoning about command-injection vulnerabilities
138+
* with sinks which are sanitized by `--`.
139+
*/
132140
module DoubleDashSanitizingFlow = TaintTracking::Global<DoubleDashSanitizingConfig>;
133141
}

go/ql/lib/semmle/go/security/ExternalAPIs.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ private module UntrustedDataConfig implements DataFlow::ConfigSig {
207207
predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
208208
}
209209

210+
/**
211+
* Tracks data flow from `RemoteFlowSource`s to `ExternalApiDataNode`s.
212+
*/
210213
module UntrustedDataToExternalApiFlow = DataFlow::Global<UntrustedDataConfig>;
211214

212215
/** DEPRECATED: Alias for UntrustedDataToExternalApiConfig */
@@ -234,6 +237,9 @@ private module UntrustedDataToUnknownExternalApiConfig implements DataFlow::Conf
234237
predicate isSink(DataFlow::Node sink) { sink instanceof UnknownExternalApiDataNode }
235238
}
236239

240+
/**
241+
* Tracks data flow from `RemoteFlowSource`s to `UnknownExternalApiDataNode`s.
242+
*/
237243
module UntrustedDataToUnknownExternalApiFlow =
238244
DataFlow::Global<UntrustedDataToUnknownExternalApiConfig>;
239245

go/ql/lib/semmle/go/security/IncorrectIntegerConversionLib.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ private module ConversionWithoutBoundsCheckConfig implements DataFlow::StateConf
257257
}
258258
}
259259

260+
/**
261+
* Tracks taint flow from an integer obtained from parsing a string flows to a
262+
* type conversion to a smaller integer type, which could cause unexpected
263+
* values.
264+
*/
260265
module Flow = TaintTracking::GlobalWithState<ConversionWithoutBoundsCheckConfig>;
261266

262267
private predicate upperBoundCheckGuard(DataFlow::Node g, Expr e, boolean branch) {

go/ql/lib/semmle/go/security/InsecureRandomness.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@ module InsecureRandomness {
4646
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
4747
}
4848

49+
/**
50+
* Tracks taint flow for reasoning about random values that are not
51+
* cryptographically secure.
52+
*/
4953
module Flow = TaintTracking::Global<Config>;
5054
}

go/ql/lib/semmle/go/security/LogInjection.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ module LogInjection {
3333
}
3434
}
3535

36-
/**
37-
* A taint-tracking configuration for reasoning about log injection vulnerabilities.
38-
*/
36+
/** Config for reasoning about log injection vulnerabilities. */
3937
module Config implements DataFlow::ConfigSig {
4038
predicate isSource(DataFlow::Node source) { source instanceof Source }
4139

@@ -44,5 +42,6 @@ module LogInjection {
4442
predicate isBarrier(DataFlow::Node sanitizer) { sanitizer instanceof Sanitizer }
4543
}
4644

45+
/** Tracks taint flow for reasoning about log injection vulnerabilities. */
4746
module Flow = TaintTracking::Global<Config>;
4847
}

go/ql/lib/semmle/go/security/OpenUrlRedirect.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,6 @@ module OpenUrlRedirect {
104104
}
105105
}
106106

107+
/** Tracks taint flow for reasoning about unvalidated URL redirections. */
107108
module Flow = DataFlow::Global<Config>;
108109
}

go/ql/lib/semmle/go/security/ReflectedXss.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ module ReflectedXss {
4646
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
4747
}
4848

49+
/** Tracks taint flow for reasoning about XSS. */
4950
module Flow = TaintTracking::Global<Config>;
5051
}

0 commit comments

Comments
 (0)