Update rust/ql/lib/codeql/rust/frameworks/rustcrypto/RustCrypto.qll

Co-authored-by: Tom Hvitved <hvitved@github.com>
This commit is contained in:
Geoffrey White
2025-08-19 09:22:53 +01:00
committed by GitHub
parent 9f04de859f
commit 401315c4f5

View File

@@ -26,9 +26,8 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range {
// `cipher::KeyIvInit::new`, `cipher::KeyIvInit::new_from_slices`, `rc2::Rc2::new_with_eff_key_len` or similar.
exists(CallExprBase ce, string rawAlgorithmName |
ce = this.asExpr().getExpr() and
ce.getStaticTarget()
.getCanonicalPath()
.matches(["%::new", "%::new_from_slice", "%::new_with_eff_key_len", "%::new_from_slices"]) and
ce.getStaticTarget().getName().getText() =
["new", "new_from_slice", "new_with_eff_key_len", "new_from_slices"] and
// extract the algorithm name from the type of `ce` or its receiver.
exists(Type t, TypePath tp |
t = inferType([ce, ce.(MethodCallExpr).getReceiver()], tp) and