Skip to content

Commit e5dfbe2

Browse files
committed
ConceptsShared: Add BlockMode#matchesString(string) predicate
1 parent 61095b3 commit e5dfbe2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

javascript/ql/lib/semmle/javascript/internal/ConceptsShared.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ module Cryptography {
9191

9292
/** Holds if this block mode is considered to be insecure. */
9393
predicate isWeak() { this = "ECB" }
94+
95+
/** Holds if the given string appears to match this block mode. */
96+
bindingset[s]
97+
predicate matchesString(string s) { s.toUpperCase().matches("%" + this + "%") }
9498
}
9599
}
96100

python/ql/lib/semmle/python/internal/ConceptsShared.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ module Cryptography {
9191

9292
/** Holds if this block mode is considered to be insecure. */
9393
predicate isWeak() { this = "ECB" }
94+
95+
/** Holds if the given string appears to match this block mode. */
96+
bindingset[s]
97+
predicate matchesString(string s) { s.toUpperCase().matches("%" + this + "%") }
9498
}
9599
}
96100

ruby/ql/lib/codeql/ruby/internal/ConceptsShared.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ module Cryptography {
9191

9292
/** Holds if this block mode is considered to be insecure. */
9393
predicate isWeak() { this = "ECB" }
94+
95+
/** Holds if the given string appears to match this block mode. */
96+
bindingset[s]
97+
predicate matchesString(string s) { s.toUpperCase().matches("%" + this + "%") }
9498
}
9599
}
96100

0 commit comments

Comments
 (0)