Skip to content

Commit 946456a

Browse files
committed
C++: Apply the sanitizer improvement from cpp/cleartext-storage-buffer in cpp/cleartext-storage-file and cpp/cleartext-transmission.
1 parent b38ad13 commit 946456a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class FromSensitiveConfiguration extends TaintTracking::Configuration {
2929
override predicate isSource(DataFlow::Node source) { source.asExpr() instanceof SensitiveExpr }
3030

3131
override predicate isSink(DataFlow::Node sink) { any(FileWrite w).getASource() = sink.asExpr() }
32+
33+
override predicate isSanitizer(DataFlow::Node node) {
34+
node.asExpr().getUnspecifiedType() instanceof IntegralType
35+
}
3236
}
3337

3438
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ class FromSensitiveConfiguration extends TaintTracking::Configuration {
234234
// flow through encryption functions to the return value (in case we can reach other sinks)
235235
node2.asExpr().(Encrypted).(FunctionCall).getAnArgument() = node1.asExpr()
236236
}
237+
238+
override predicate isSanitizer(DataFlow::Node node) {
239+
node.asExpr().getUnspecifiedType() instanceof IntegralType
240+
}
237241
}
238242

239243
from

cpp/ql/test/query-tests/Security/CWE/CWE-311/semmle/tests/CleartextFileWrite.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
edges
2-
| test2.cpp:52:44:52:57 | password_tries | test2.cpp:52:40:52:58 | * ... |
32
| test2.cpp:62:18:62:25 | password | test2.cpp:65:31:65:34 | cpy1 |
43
| test2.cpp:72:17:72:24 | password | test2.cpp:73:30:73:32 | buf |
54
| test2.cpp:72:17:72:24 | password | test2.cpp:76:30:76:32 | buf |
@@ -9,8 +8,6 @@ nodes
98
| test2.cpp:44:37:44:45 | thepasswd | semmle.label | thepasswd |
109
| test2.cpp:45:38:45:47 | accountkey | semmle.label | accountkey |
1110
| test2.cpp:50:41:50:53 | passwd_config | semmle.label | passwd_config |
12-
| test2.cpp:52:40:52:58 | * ... | semmle.label | * ... |
13-
| test2.cpp:52:44:52:57 | password_tries | semmle.label | password_tries |
1411
| test2.cpp:54:41:54:52 | widepassword | semmle.label | widepassword |
1512
| test2.cpp:55:40:55:51 | widepassword | semmle.label | widepassword |
1613
| test2.cpp:57:39:57:49 | call to getPassword | semmle.label | call to getPassword |

0 commit comments

Comments
 (0)