Skip to content

Commit 65f31d4

Browse files
committed
Swift: mass enable diff-informed data flow
1 parent 772b972 commit 65f31d4

29 files changed

+111
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
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+
// swift/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

Lines changed: 19 additions & 0 deletions
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+
// swift/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+
// swift/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+
// swift/ql/lib/codeql/swift/regex/Regex.qll:364: Flow call outside 'select' clause
121+
// swift/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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ 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() { any() }
5153
}
5254

5355
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ 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() { any() }
3335
}
3436

3537
/**

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

Lines changed: 6 additions & 0 deletions
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+
// swift/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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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>;

0 commit comments

Comments
 (0)