Skip to content

Commit 8928a11

Browse files
committed
feat: support getSaltConfigSrc for Argon2 variants
1 parent 2642af1 commit 8928a11

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/ql/lib/experimental/cryptography/modules/CryptographyModule.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ module KDF {
111111
}
112112

113113
override predicate requiresSalt() {
114-
this.getAlgorithm().getKDFName() in ["PBKDF2HMAC", "CONCATKDFHMAC", "HKDF", "SCRYPT"]
114+
this.getAlgorithm().getKDFName() in ["PBKDF2HMAC", "CONCATKDFHMAC", "HKDF", "SCRYPT", "ARGON2"]
115115
}
116116

117117
override predicate requiresIteration() { this.getAlgorithm().getKDFName() in ["PBKDF2HMAC"] }
@@ -124,8 +124,11 @@ module KDF {
124124

125125
override DataFlow::Node getSaltConfigSrc() {
126126
this.requiresSalt() and
127+
// ARGON2 variants have it as a keyword-only parameter
128+
if this.getAlgorithm().getKDFName() = "ARGON2"
129+
then result = Utils::getUltimateSrcFromApiNode(this.getKeywordParameter("salt"))
127130
// SCRYPT has it in arg 1
128-
if this.getAlgorithm().getKDFName() = "SCRYPT"
131+
else if this.getAlgorithm().getKDFName() = "SCRYPT"
129132
then result = Utils::getUltimateSrcFromApiNode(this.getParameter(1, "salt"))
130133
else
131134
// EVERYTHING ELSE that uses salt is in arg 2

0 commit comments

Comments
 (0)