mirror of
https://github.com/github/codeql.git
synced 2026-03-27 09:48:16 +01:00
add draft code to find algo type to replace tainttracking configs
This commit is contained in:
@@ -252,6 +252,7 @@ string getASecureAlgorithmName() {
|
||||
"Blowfish", "ECIES" // ! Blowfish not actually secure based on https://rules.sonarsource.com/java/type/Vulnerability/RSPEC-4426 ??
|
||||
// ! hmm, other sources imply that it is secure...
|
||||
// ! also no DH here, etc.?
|
||||
// ! also is ECB matched with AES?
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +155,26 @@ private predicate hasShortAESKey(MethodAccess ma, string msg) {
|
||||
bindingset[type]
|
||||
private predicate hasShortAsymmetricKeyPair(MethodAccess ma, string msg, string type) {
|
||||
ma.getMethod() instanceof KeyPairGeneratorInitMethod and
|
||||
ma.getQualifier() instanceof JavaSecurityKeyPairGenerator and
|
||||
ma.getQualifier().getBasicBlock() instanceof JavaSecurityKeyPairGenerator and
|
||||
//ma.getQualifier().getBasicBlock().getNode(2) instanceof JavaSecurityKeyPairGenerator and
|
||||
// ma.getQualifier()
|
||||
// .getBasicBlock()
|
||||
// .getANode()
|
||||
// .(JavaSecurityKeyPairGenerator)
|
||||
// .getAlgoSpec()
|
||||
// .(StringLiteral)
|
||||
// .getValue()
|
||||
// .toUpperCase() = type and
|
||||
//ma.getQualifier().getBasicBlock().getAPredecessor() instanceof JavaSecurityKeyPairGenerator and
|
||||
ma.getQualifier()
|
||||
.getBasicBlock()
|
||||
.getAPredecessor()
|
||||
.(JavaSecurityKeyPairGenerator)
|
||||
.getAlgoSpec()
|
||||
.(StringLiteral)
|
||||
.getValue()
|
||||
.toUpperCase() = type and
|
||||
// flow needed to correctly determine algorithm type and
|
||||
// not match to ANY asymmetric algorithm
|
||||
exists(
|
||||
|
||||
Reference in New Issue
Block a user