mirror of
https://github.com/github/codeql.git
synced 2026-05-03 20:58:03 +02:00
Use CryptoAlgoSpec rather than hadcoding Cipher.getInstance
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/** Definitions for the RSE without OAEP query */
|
||||
|
||||
import java
|
||||
import Encryption
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
|
||||
/** Holds if `ma` is a call to `Cipher.getInstance` which initialises an RSA cipher without using OAEP padding. */
|
||||
predicate rsaWithoutOaepCall(MethodAccess ma) {
|
||||
ma.getMethod().hasQualifiedName("javax.crypto", "Cipher", "getInstance") and
|
||||
/** Holds if `c` is a call which initialises an RSA cipher without using OAEP padding. */
|
||||
predicate rsaWithoutOaepCall(CryptoAlgoSpec c) {
|
||||
exists(CompileTimeConstantExpr specExpr, string spec |
|
||||
specExpr.getStringValue() = spec and
|
||||
DataFlow::localExprFlow(specExpr, ma.getArgument(0)) and
|
||||
DataFlow::localExprFlow(specExpr, c.getAlgoSpec()) and
|
||||
spec.matches("RSA/%") and
|
||||
not spec.matches("%OAEP%")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user