Skip to content

Commit cdf261b

Browse files
committed
C++: In fact it's just not good enough to get additional evidence from the declaring type.
1 parent 88dc086 commit cdf261b

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

cpp/ql/src/Security/CWE/CWE-327/BrokenCryptoAlgorithm.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ Function getAnInsecureEncryptionFunction() {
3131
Function getAdditionalEvidenceFunction() {
3232
(
3333
isEncryptionAdditionalEvidence(result.getName()) or
34-
isEncryptionAdditionalEvidence(result.getAParameter().getName()) or
35-
isEncryptionAdditionalEvidence(result.getDeclaringType().getName())
34+
isEncryptionAdditionalEvidence(result.getAParameter().getName())
3635
) and
3736
exists(result.getACallToThisFunction())
3837
}

cpp/ql/test/query-tests/Security/CWE/CWE-327/BrokenCryptoAlgorithm.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
| test2.cpp:182:38:182:45 | ALGO_DES | This macro invocation specifies a broken or weak cryptographic algorithm. |
88
| test2.cpp:185:38:185:44 | USE_DES | This enum constant access specifies a broken or weak cryptographic algorithm. |
99
| test2.cpp:238:2:238:20 | call to encrypt | This function call specifies a broken or weak cryptographic algorithm. |
10-
| test2.cpp:240:2:240:28 | call to doSomethingElse | This function call specifies a broken or weak cryptographic algorithm. |
1110
| test2.cpp:245:5:245:11 | call to encrypt | This function call specifies a broken or weak cryptographic algorithm. |
12-
| test2.cpp:247:5:247:19 | call to doSomethingElse | This function call specifies a broken or weak cryptographic algorithm. |
1311
| test.cpp:38:2:38:31 | ENCRYPT_WITH_DES(data,amount) | This macro invocation specifies a broken or weak cryptographic algorithm. |
1412
| test.cpp:39:2:39:31 | ENCRYPT_WITH_RC2(data,amount) | This macro invocation specifies a broken or weak cryptographic algorithm. |
1513
| test.cpp:41:2:41:32 | ENCRYPT_WITH_3DES(data,amount) | This macro invocation specifies a broken or weak cryptographic algorithm. |

cpp/ql/test/query-tests/Security/CWE/CWE-327/test2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ void do_classes(const char *data)
237237
{
238238
desEncrypt::encrypt(data); // BAD
239239
aes256Encrypt::encrypt(data); // GOOD
240-
desEncrypt::doSomethingElse(); // GOOD [FALSE POSITIVE]
240+
desEncrypt::doSomethingElse(); // GOOD
241241
aes256Encrypt::doSomethingElse(); // GOOD
242242

243243
desCipher dc;
244244
aesCipher ac;
245245
dc.encrypt(data); // BAD
246246
ac.encrypt(data); // GOOD
247-
dc.doSomethingElse(); // GOOD [FALSE POSITIVE]
247+
dc.doSomethingElse(); // GOOD
248248
ac.doSomethingElse(); // GOOD
249249
}
250250

0 commit comments

Comments
 (0)