Skip to content

Commit 701386c

Browse files
committed
Go: mass enable diff-informed data flow
1 parent 28f3073 commit 701386c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+320
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ module StringOps {
231231
call.getTarget().hasQualifiedName("strings", "Replacer", ["Replace", "WriteString"])
232232
)
233233
}
234+
235+
predicate observeDiffInformedIncrementalMode() {
236+
// TODO(diff-informed): Manually verify if config can be diff-informed.
237+
// ql/lib/semmle/go/StringOps.qll:250: Flow call outside 'select' clause
238+
none()
239+
}
234240
}
235241

236242
/**

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ module AllocationSizeOverflow {
1919
predicate isSink(DataFlow::Node nd) { nd = Builtin::len().getACall().getArgument(0) }
2020

2121
predicate isBarrier(DataFlow::Node nd) { nd instanceof Sanitizer }
22+
23+
predicate observeDiffInformedIncrementalMode() {
24+
// TODO(diff-informed): Manually verify if config can be diff-informed.
25+
// ql/lib/semmle/go/security/AllocationSizeOverflow.qll:30: Flow call outside 'select' clause
26+
none()
27+
}
2228
}
2329

2430
/**
@@ -56,6 +62,12 @@ module AllocationSizeOverflow {
5662
succ = c
5763
)
5864
}
65+
66+
predicate observeDiffInformedIncrementalMode() {
67+
// TODO(diff-informed): Manually verify if config can be diff-informed.
68+
// ql/src/Security/CWE-190/AllocationSizeOverflow.ql:25: Column 5 does not select a source or sink originating from the flow call on line 22
69+
none()
70+
}
5971
}
6072

6173
/** Tracks taint flow to find allocation-size overflows. */

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ module CleartextLogging {
4646
// Also exclude protobuf field fetches, since they amount to single field reads.
4747
not any(Protobuf::GetMethod gm).taintStep(src, trg)
4848
}
49+
50+
predicate observeDiffInformedIncrementalMode() { any() }
4951
}
5052

5153
/**

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ module CommandInjection {
2424
}
2525

2626
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
27+
28+
predicate observeDiffInformedIncrementalMode() {
29+
// TODO(diff-informed): Manually verify if config can be diff-informed.
30+
// ql/src/Security/CWE-078/CommandInjection.ql:28: Column 1 does not select a source or sink originating from the flow call on line 26
31+
// ql/src/Security/CWE-078/CommandInjection.ql:28: Column 5 does not select a source or sink originating from the flow call on line 26
32+
none()
33+
}
2734
}
2835

2936
/**
@@ -80,6 +87,13 @@ module CommandInjection {
8087
node instanceof Sanitizer or
8188
node = any(ArgumentArrayWithDoubleDash array).getASanitizedElement()
8289
}
90+
91+
predicate observeDiffInformedIncrementalMode() {
92+
// TODO(diff-informed): Manually verify if config can be diff-informed.
93+
// ql/src/Security/CWE-078/CommandInjection.ql:28: Column 1 does not select a source or sink originating from the flow call on line 27
94+
// ql/src/Security/CWE-078/CommandInjection.ql:28: Column 5 does not select a source or sink originating from the flow call on line 27
95+
none()
96+
}
8397
}
8498

8599
/**

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ private module UntrustedDataConfig implements DataFlow::ConfigSig {
186186
predicate isSource(DataFlow::Node source) { source instanceof ActiveThreatModelSource }
187187

188188
predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
189+
190+
predicate observeDiffInformedIncrementalMode() {
191+
// TODO(diff-informed): Manually verify if config can be diff-informed.
192+
// ql/lib/semmle/go/security/ExternalAPIs.qll:210: Flow call outside 'select' clause
193+
// ql/lib/semmle/go/security/ExternalAPIs.qll:213: Flow call outside 'select' clause
194+
none()
195+
}
189196
}
190197

191198
/**
@@ -197,6 +204,8 @@ private module UntrustedDataToUnknownExternalApiConfig implements DataFlow::Conf
197204
predicate isSource(DataFlow::Node source) { source instanceof ActiveThreatModelSource }
198205

199206
predicate isSink(DataFlow::Node sink) { sink instanceof UnknownExternalApiDataNode }
207+
208+
predicate observeDiffInformedIncrementalMode() { any() }
200209
}
201210

202211
/**

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ module HardcodedCredentials {
3030
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
3131

3232
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
33+
34+
predicate observeDiffInformedIncrementalMode() {
35+
// TODO(diff-informed): Manually verify if config can be diff-informed.
36+
// ql/src/Security/CWE-798/HardcodedCredentials.ql:65: Column 1 does not select a source or sink originating from the flow call on line 62
37+
// ql/src/Security/CWE-798/HardcodedCredentials.ql:65: Column 3 does not select a source or sink originating from the flow call on line 62
38+
none()
39+
}
3340
}
3441

3542
/** Tracks taint flow for reasoning about hardcoded credentials. */

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,12 @@ private module ConversionWithoutBoundsCheckConfig implements DataFlow::StateConf
440440
state2 = node2.(FlowStateTransformer).transform(state1) and
441441
DataFlow::simpleLocalFlowStep(node1, node2, _)
442442
}
443+
444+
predicate observeDiffInformedIncrementalMode() {
445+
// TODO(diff-informed): Manually verify if config can be diff-informed.
446+
// ql/src/Security/CWE-681/IncorrectIntegerConversionQuery.ql:26: Column 1 selects sink.getASuccessor
447+
none()
448+
}
443449
}
444450

445451
/**

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ module InsecureRandomness {
3939
n2.getType() instanceof IntegerType
4040
)
4141
}
42+
43+
predicate observeDiffInformedIncrementalMode() {
44+
// TODO(diff-informed): Manually verify if config can be diff-informed.
45+
// ql/src/Security/CWE-338/InsecureRandomness.ql:33: Column 1 does not select a source or sink originating from the flow call on line 26
46+
// ql/src/Security/CWE-338/InsecureRandomness.ql:34: Column 5 does not select a source or sink originating from the flow call on line 26
47+
none()
48+
}
4249
}
4350

4451
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module LogInjection {
2121
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
2222

2323
predicate isBarrier(DataFlow::Node sanitizer) { sanitizer instanceof Sanitizer }
24+
25+
predicate observeDiffInformedIncrementalMode() { any() }
2426
}
2527

2628
/** Tracks taint flow for reasoning about log injection vulnerabilities. */

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module MissingJwtSignatureCheck {
2323
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2424
any(AdditionalFlowStep s).step(nodeFrom, nodeTo)
2525
}
26+
27+
predicate observeDiffInformedIncrementalMode() { any() }
2628
}
2729

2830
/** Tracks taint flow for reasoning about JWT vulnerabilities. */
@@ -36,6 +38,12 @@ module MissingJwtSignatureCheck {
3638
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
3739
any(AdditionalFlowStep s).step(nodeFrom, nodeTo)
3840
}
41+
42+
predicate observeDiffInformedIncrementalMode() {
43+
// TODO(diff-informed): Manually verify if config can be diff-informed.
44+
// ql/lib/semmle/go/security/MissingJwtSignatureCheck.qll:18: Flow call outside 'select' clause
45+
none()
46+
}
3947
}
4048

4149
private module SafeParse = TaintTracking::Global<SafeParseConfig>;

0 commit comments

Comments
 (0)