Skip to content

Commit 05df2f2

Browse files
committed
[DIFF-INFORMED] C++: CWE-311/Cleartext…
1 parent 2191403 commit 05df2f2

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ module ToBufferConfig implements DataFlow::ConfigSig {
4747
}
4848

4949
predicate isSink(DataFlow::Node sink) { isSinkImpl(sink, _) }
50+
51+
predicate observeDiffInformedIncrementalMode() { any() }
52+
53+
Location getASelectedSinkLocation(DataFlow::Node sink) {
54+
exists(SensitiveBufferWrite w | result = w.getLocation() | isSinkImpl(sink, w))
55+
}
5056
}
5157

5258
module ToBufferFlow = TaintTracking::Global<ToBufferConfig>;

cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ module FromSensitiveConfig implements DataFlow::ConfigSig {
3131
predicate isBarrier(DataFlow::Node node) {
3232
node.asExpr().getUnspecifiedType() instanceof IntegralType
3333
}
34+
35+
predicate observeDiffInformedIncrementalMode() { any() }
36+
37+
Location getASelectedSourceLocation(DataFlow::Node sourceNode) {
38+
exists(SensitiveExpr source | result = source.getLocation() | isSourceImpl(sourceNode, source))
39+
}
40+
41+
Location getASelectedSinkLocation(DataFlow::Node sink) {
42+
exists(FileWrite w | result = w.getLocation() | isSinkImpl(sink, w, _))
43+
}
3444
}
3545

3646
module FromSensitiveFlow = TaintTracking::Global<FromSensitiveConfig>;

cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ module FromSensitiveConfig implements DataFlow::ConfigSig {
245245
// sources to not get path duplication.
246246
isSource(node)
247247
}
248+
249+
predicate observeDiffInformedIncrementalMode() { any() }
250+
251+
Location getASelectedSinkLocation(DataFlow::Node sink) {
252+
exists(NetworkSendRecv networkSendRecv | result = networkSendRecv.getLocation() |
253+
isSinkSendRecv(sink, networkSendRecv)
254+
)
255+
}
248256
}
249257

250258
module FromSensitiveFlow = TaintTracking::Global<FromSensitiveConfig>;
@@ -266,6 +274,10 @@ module ToEncryptionConfig implements DataFlow::ConfigSig {
266274
// sources to not get path duplication.
267275
isSource(node)
268276
}
277+
278+
predicate observeDiffInformedIncrementalMode() {
279+
none() // only used negatively
280+
}
269281
}
270282

271283
module ToEncryptionFlow = TaintTracking::Global<ToEncryptionConfig>;
@@ -281,6 +293,10 @@ module FromEncryptionConfig implements DataFlow::ConfigSig {
281293
predicate isBarrier(DataFlow::Node node) {
282294
node.asExpr().getUnspecifiedType() instanceof IntegralType
283295
}
296+
297+
predicate observeDiffInformedIncrementalMode() {
298+
none() // only used negatively
299+
}
284300
}
285301

286302
module FromEncryptionFlow = TaintTracking::Global<FromEncryptionConfig>;

0 commit comments

Comments
 (0)