Skip to content

Commit e059c93

Browse files
committed
Go: mass enable diff-informed data flow
1 parent 772b972 commit e059c93

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

+264
-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+
// go/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: 8 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+
// go/ql/lib/semmle/go/security/AllocationSizeOverflow.qll:30: Flow call outside 'select' clause
26+
none()
27+
}
2228
}
2329

2430
/**
@@ -56,6 +62,8 @@ module AllocationSizeOverflow {
5662
succ = c
5763
)
5864
}
65+
66+
predicate observeDiffInformedIncrementalMode() { any() }
5967
}
6068

6169
/** 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ module CommandInjection {
2424
}
2525

2626
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
27+
28+
predicate observeDiffInformedIncrementalMode() { any() }
2729
}
2830

2931
/**
@@ -80,6 +82,8 @@ module CommandInjection {
8082
node instanceof Sanitizer or
8183
node = any(ArgumentArrayWithDoubleDash array).getASanitizedElement()
8284
}
85+
86+
predicate observeDiffInformedIncrementalMode() { any() }
8387
}
8488

8589
/**

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+
// go/ql/lib/semmle/go/security/ExternalAPIs.qll:210: Flow call outside 'select' clause
193+
// go/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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ 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() { any() }
3335
}
3436

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ private module ConversionWithoutBoundsCheckConfig implements DataFlow::StateConf
440440
state2 = node2.(FlowStateTransformer).transform(state1) and
441441
DataFlow::simpleLocalFlowStep(node1, node2, _)
442442
}
443+
444+
predicate observeDiffInformedIncrementalMode() { any() }
443445
}
444446

445447
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ module InsecureRandomness {
3939
n2.getType() instanceof IntegerType
4040
)
4141
}
42+
43+
predicate observeDiffInformedIncrementalMode() { any() }
4244
}
4345

4446
/**

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ 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() {
26+
// TODO(diff-informed): Manually verify if config can be diff-informed.
27+
// shared/dataflow/codeql/dataflow/test/InlineFlowTest.qll:122: Flow call outside 'select' clause
28+
// shared/dataflow/codeql/dataflow/test/InlineFlowTest.qll:140: Flow call outside 'select' clause
29+
none()
30+
}
2431
}
2532

2633
/** 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+
// go/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)