mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Java: Refactor RsaWithoutOaep.
This commit is contained in:
@@ -4,8 +4,12 @@ import java
|
||||
import Encryption
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
|
||||
/** A configuration for finding RSA ciphers initialized without using OAEP padding. */
|
||||
class RsaWithoutOaepConfig extends DataFlow::Configuration {
|
||||
/**
|
||||
* DEPRECATED: Use `RsaWithoutOaepFlow` instead.
|
||||
*
|
||||
* A configuration for finding RSA ciphers initialized without using OAEP padding.
|
||||
*/
|
||||
deprecated class RsaWithoutOaepConfig extends DataFlow::Configuration {
|
||||
RsaWithoutOaepConfig() { this = "RsaWithoutOaepConfig" }
|
||||
|
||||
override predicate isSource(DataFlow::Node src) {
|
||||
@@ -21,3 +25,21 @@ class RsaWithoutOaepConfig extends DataFlow::Configuration {
|
||||
exists(CryptoAlgoSpec cr | sink.asExpr() = cr.getAlgoSpec())
|
||||
}
|
||||
}
|
||||
|
||||
private module RsaWithoutOaepConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node src) {
|
||||
exists(CompileTimeConstantExpr specExpr, string spec |
|
||||
specExpr.getStringValue() = spec and
|
||||
specExpr = src.asExpr() and
|
||||
spec.matches("RSA/%") and
|
||||
not spec.matches("%OAEP%")
|
||||
)
|
||||
}
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(CryptoAlgoSpec cr | sink.asExpr() = cr.getAlgoSpec())
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow for finding RSA ciphers initialized without using OAEP padding. */
|
||||
module RsaWithoutOaepFlow = DataFlow::Make<RsaWithoutOaepConfig>;
|
||||
|
||||
Reference in New Issue
Block a user