Skip to content

Commit 1f0b362

Browse files
committed
Swift: mass enable diff-informed data flow
1 parent 28f3073 commit 1f0b362

27 files changed

+91
-0
lines changed

swift/ql/lib/codeql/swift/regex/Regex.qll

+6
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,12 @@ private module NSStringCompareOptionsFlagConfig implements DataFlow::ConfigSig {
491491
isSink(node) and
492492
c.getAReadContent() instanceof DataFlow::Content::CollectionContent
493493
}
494+
495+
predicate observeDiffInformedIncrementalMode() {
496+
// TODO(diff-informed): Manually verify if config can be diff-informed.
497+
// ql/lib/codeql/swift/regex/Regex.qll:507: Flow call outside 'select' clause
498+
none()
499+
}
494500
}
495501

496502
module NSStringCompareOptionsFlagFlow = DataFlow::Global<NSStringCompareOptionsFlagConfig>;

swift/ql/lib/codeql/swift/regex/internal/RegexTracking.qll

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ private module StringLiteralUseConfig implements DataFlow::ConfigSig {
2525
// used to create a regular expression object
2626
node = any(RegexCreation regexCreation).getStringInput()
2727
}
28+
29+
predicate observeDiffInformedIncrementalMode() {
30+
// TODO(diff-informed): Manually verify if config can be diff-informed.
31+
// ql/lib/codeql/swift/regex/Regex.qll:53: Flow call outside 'select' clause
32+
none()
33+
}
2834
}
2935

3036
module StringLiteralUseFlow = DataFlow::Global<StringLiteralUseConfig>;
@@ -47,6 +53,12 @@ private module RegexUseConfig implements DataFlow::ConfigSig {
4753
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
4854
any(RegexAdditionalFlowStep s).step(nodeFrom, nodeTo)
4955
}
56+
57+
predicate observeDiffInformedIncrementalMode() {
58+
// TODO(diff-informed): Manually verify if config can be diff-informed.
59+
// ql/lib/codeql/swift/regex/Regex.qll:350: Flow call outside 'select' clause
60+
none()
61+
}
5062
}
5163

5264
module RegexUseFlow = DataFlow::Global<RegexUseConfig>;
@@ -102,6 +114,13 @@ private module RegexParseModeConfig implements DataFlow::StateConfigSig {
102114
) {
103115
none()
104116
}
117+
118+
predicate observeDiffInformedIncrementalMode() {
119+
// TODO(diff-informed): Manually verify if config can be diff-informed.
120+
// ql/lib/codeql/swift/regex/Regex.qll:364: Flow call outside 'select' clause
121+
// ql/lib/codeql/swift/regex/Regex.qll:365: Flow call outside 'select' clause
122+
none()
123+
}
105124
}
106125

107126
module RegexParseModeFlow = DataFlow::GlobalWithState<RegexParseModeConfig>;

swift/ql/lib/codeql/swift/security/CleartextLoggingQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module CleartextLoggingConfig implements DataFlow::ConfigSig {
2525
predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) {
2626
any(CleartextLoggingAdditionalFlowStep s).step(n1, n2)
2727
}
28+
29+
predicate observeDiffInformedIncrementalMode() { any() }
2830
}
2931

3032
/**

swift/ql/lib/codeql/swift/security/CleartextStorageDatabaseQuery.qll

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ module CleartextStorageDatabaseConfig implements DataFlow::ConfigSig {
4848
node.asExpr().getType().getUnderlyingType() instanceof DictionaryType and
4949
c.getAReadContent().(DataFlow::Content::TupleContent).getIndex() = 1
5050
}
51+
52+
predicate observeDiffInformedIncrementalMode() {
53+
// TODO(diff-informed): Manually verify if config can be diff-informed.
54+
// ql/src/queries/Security/CWE-311/CleartextStorageDatabase.ql:35: Column 1 does not select a source or sink originating from the flow call on line 33
55+
none()
56+
}
5157
}
5258

5359
/**

swift/ql/lib/codeql/swift/security/CleartextStoragePreferencesQuery.qll

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ module CleartextStoragePreferencesConfig implements DataFlow::ConfigSig {
3030
// make sources barriers so that we only report the closest instance
3131
isSource(node)
3232
}
33+
34+
predicate observeDiffInformedIncrementalMode() {
35+
// TODO(diff-informed): Manually verify if config can be diff-informed.
36+
// ql/src/queries/Security/CWE-312/CleartextStoragePreferences.ql:34: Column 1 does not select a source or sink originating from the flow call on line 32
37+
none()
38+
}
3339
}
3440

3541
/**

swift/ql/lib/codeql/swift/security/CleartextTransmissionExtensions.qll

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ private module ExcludeUrlConfig implements DataFlow::ConfigSig {
7373
}
7474

7575
predicate isSink(DataFlow::Node node) { urlInit(_, node.asExpr()) }
76+
77+
predicate observeDiffInformedIncrementalMode() {
78+
// TODO(diff-informed): Manually verify if config can be diff-informed.
79+
// ql/lib/codeql/swift/security/CleartextTransmissionExtensions.qll:90: Flow call outside 'select' clause
80+
none()
81+
}
7682
}
7783

7884
private module ExcludeUrlFlow = TaintTracking::Global<ExcludeUrlConfig>;

swift/ql/lib/codeql/swift/security/CleartextTransmissionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ module CleartextTransmissionConfig implements DataFlow::ConfigSig {
2828
// make sources barriers so that we only report the closest instance
2929
isSource(node)
3030
}
31+
32+
predicate observeDiffInformedIncrementalMode() { any() }
3133
}
3234

3335
/**

swift/ql/lib/codeql/swift/security/CommandInjectionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module CommandInjectionConfig implements DataFlow::ConfigSig {
2323
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2424
any(CommandInjectionAdditionalFlowStep s).step(nodeFrom, nodeTo)
2525
}
26+
27+
predicate observeDiffInformedIncrementalMode() { any() }
2628
}
2729

2830
/**

swift/ql/lib/codeql/swift/security/ConstantPasswordQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ module ConstantPasswordConfig implements DataFlow::ConfigSig {
3838
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
3939
any(ConstantPasswordAdditionalFlowStep s).step(nodeFrom, nodeTo)
4040
}
41+
42+
predicate observeDiffInformedIncrementalMode() { any() }
4143
}
4244

4345
module ConstantPasswordFlow = TaintTracking::Global<ConstantPasswordConfig>;

swift/ql/lib/codeql/swift/security/ConstantSaltQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ module ConstantSaltConfig implements DataFlow::ConfigSig {
3939
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
4040
any(ConstantSaltAdditionalFlowStep s).step(nodeFrom, nodeTo)
4141
}
42+
43+
predicate observeDiffInformedIncrementalMode() { any() }
4244
}
4345

4446
module ConstantSaltFlow = TaintTracking::Global<ConstantSaltConfig>;

swift/ql/lib/codeql/swift/security/ECBEncryptionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module EcbEncryptionConfig implements DataFlow::ConfigSig {
2222
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2323
any(EcbEncryptionAdditionalFlowStep s).step(nodeFrom, nodeTo)
2424
}
25+
26+
predicate observeDiffInformedIncrementalMode() { any() }
2527
}
2628

2729
module EcbEncryptionFlow = DataFlow::Global<EcbEncryptionConfig>;

swift/ql/lib/codeql/swift/security/HardcodedEncryptionKeyQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ module HardcodedKeyConfig implements DataFlow::ConfigSig {
4646
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
4747
any(HardcodedEncryptionKeyAdditionalFlowStep s).step(nodeFrom, nodeTo)
4848
}
49+
50+
predicate observeDiffInformedIncrementalMode() { any() }
4951
}
5052

5153
module HardcodedKeyFlow = TaintTracking::Global<HardcodedKeyConfig>;

swift/ql/lib/codeql/swift/security/InsecureTLSQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module InsecureTlsConfig implements DataFlow::ConfigSig {
2121
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2222
any(InsecureTlsExtensionsAdditionalFlowStep s).step(nodeFrom, nodeTo)
2323
}
24+
25+
predicate observeDiffInformedIncrementalMode() { any() }
2426
}
2527

2628
module InsecureTlsFlow = TaintTracking::Global<InsecureTlsConfig>;

swift/ql/lib/codeql/swift/security/InsufficientHashIterationsQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ module InsufficientHashIterationsConfig implements DataFlow::ConfigSig {
3434
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
3535
any(InsufficientHashIterationsAdditionalFlowStep s).step(nodeFrom, nodeTo)
3636
}
37+
38+
predicate observeDiffInformedIncrementalMode() { any() }
3739
}
3840

3941
module InsufficientHashIterationsFlow = TaintTracking::Global<InsufficientHashIterationsConfig>;

swift/ql/lib/codeql/swift/security/PathInjectionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module PathInjectionConfig implements DataFlow::ConfigSig {
2323
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
2424
any(PathInjectionAdditionalFlowStep s).step(node1, node2)
2525
}
26+
27+
predicate observeDiffInformedIncrementalMode() { any() }
2628
}
2729

2830
/**

swift/ql/lib/codeql/swift/security/PredicateInjectionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module PredicateInjectionConfig implements DataFlow::ConfigSig {
2222
predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) {
2323
any(PredicateInjectionAdditionalFlowStep s).step(n1, n2)
2424
}
25+
26+
predicate observeDiffInformedIncrementalMode() { any() }
2527
}
2628

2729
/**

swift/ql/lib/codeql/swift/security/SqlInjectionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module SqlInjectionConfig implements DataFlow::ConfigSig {
2323
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2424
any(SqlInjectionAdditionalFlowStep s).step(nodeFrom, nodeTo)
2525
}
26+
27+
predicate observeDiffInformedIncrementalMode() { any() }
2628
}
2729

2830
/**

swift/ql/lib/codeql/swift/security/StaticInitializationVectorQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ module StaticInitializationVectorConfig implements DataFlow::ConfigSig {
4040
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
4141
any(StaticInitializationVectorAdditionalFlowStep s).step(nodeFrom, nodeTo)
4242
}
43+
44+
predicate observeDiffInformedIncrementalMode() { any() }
4345
}
4446

4547
module StaticInitializationVectorFlow = TaintTracking::Global<StaticInitializationVectorConfig>;

swift/ql/lib/codeql/swift/security/StringLengthConflationQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ module StringLengthConflationConfig implements DataFlow::StateConfigSig {
3939
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
4040
any(StringLengthConflationAdditionalFlowStep s).step(nodeFrom, nodeTo)
4141
}
42+
43+
predicate observeDiffInformedIncrementalMode() { any() }
4244
}
4345

4446
/**

swift/ql/lib/codeql/swift/security/UncontrolledFormatStringQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module TaintedFormatConfig implements DataFlow::ConfigSig {
2323
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2424
any(UncontrolledFormatStringAdditionalFlowStep s).step(nodeFrom, nodeTo)
2525
}
26+
27+
predicate observeDiffInformedIncrementalMode() { any() }
2628
}
2729

2830
/**

swift/ql/lib/codeql/swift/security/UnsafeJsEvalQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module UnsafeJsEvalConfig implements DataFlow::ConfigSig {
2222
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2323
any(UnsafeJsEvalAdditionalFlowStep s).step(nodeFrom, nodeTo)
2424
}
25+
26+
predicate observeDiffInformedIncrementalMode() { any() }
2527
}
2628

2729
/**

swift/ql/lib/codeql/swift/security/UnsafeUnpackQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ module UnsafeUnpackConfig implements DataFlow::ConfigSig {
2424
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2525
any(UnsafeUnpackAdditionalFlowStep s).step(nodeFrom, nodeTo)
2626
}
27+
28+
predicate observeDiffInformedIncrementalMode() { any() }
2729
}
2830

2931
/**

swift/ql/lib/codeql/swift/security/UnsafeWebViewFetchQuery.qll

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ module UnsafeWebViewFetchConfig implements DataFlow::ConfigSig {
2828
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2929
any(UnsafeWebViewFetchAdditionalFlowStep s).step(nodeFrom, nodeTo)
3030
}
31+
32+
predicate observeDiffInformedIncrementalMode() {
33+
// TODO(diff-informed): Manually verify if config can be diff-informed.
34+
// ql/src/queries/Security/CWE-079/UnsafeWebViewFetch.ql:39: Column 1 does not select a source or sink originating from the flow call on line 36
35+
none()
36+
}
3137
}
3238

3339
/**

swift/ql/lib/codeql/swift/security/WeakPasswordHashingQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ module WeakPasswordHashingConfig implements DataFlow::ConfigSig {
3737
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
3838
any(WeakPasswordHashingAdditionalFlowStep s).step(nodeFrom, nodeTo)
3939
}
40+
41+
predicate observeDiffInformedIncrementalMode() { any() }
4042
}
4143

4244
module WeakPasswordHashingFlow = TaintTracking::Global<WeakPasswordHashingConfig>;

swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ module WeakSensitiveDataHashingConfig implements DataFlow::ConfigSig {
3838
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
3939
any(WeakSensitiveDataHashingAdditionalFlowStep s).step(nodeFrom, nodeTo)
4040
}
41+
42+
predicate observeDiffInformedIncrementalMode() { any() }
4143
}
4244

4345
deprecated module WeakHashingConfig = WeakSensitiveDataHashingConfig;

swift/ql/lib/codeql/swift/security/XXEQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module XxeConfig implements DataFlow::ConfigSig {
2222
predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) {
2323
any(XxeAdditionalFlowStep s).step(n1, n2)
2424
}
25+
26+
predicate observeDiffInformedIncrementalMode() { any() }
2527
}
2628

2729
/**

swift/ql/lib/codeql/swift/security/regex/RegexInjectionQuery.qll

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module RegexInjectionConfig implements DataFlow::ConfigSig {
2222
predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
2323
any(RegexInjectionAdditionalFlowStep s).step(nodeFrom, nodeTo)
2424
}
25+
26+
predicate observeDiffInformedIncrementalMode() { any() }
2527
}
2628

2729
/**

0 commit comments

Comments
 (0)