Skip to content

Commit 7241e09

Browse files
committed
Replace convertBytesToString with models
1 parent e9ca4a2 commit 7241e09

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

java/ql/lib/ext/org.owasp.esapi.model.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ extensions:
33
pack: codeql/java-all
44
extensible: summaryModel
55
data:
6-
- ["org.owasp.esapi", "Encoder", true, "encodeForHTML", "(String)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
6+
- ["org.owasp.esapi", "Encoder", true, "encodeForHTML", "(String)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
7+
- ["org.owasp.esapi", "Encoder", true, "encodeForBase64", "(byte[],boolean)", "", "Argument[0]", "ReturnValue", "taint", "manual"]

java/ql/lib/semmle/code/java/security/WeakRandomnessQuery.qll

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,6 @@ private class SensitiveActionSink extends WeakRandomnessSink {
6565

6666
private class CredentialsSink extends WeakRandomnessSink instanceof CredentialsSinkNode { }
6767

68-
/**
69-
* Holds if there is a method access which converts `bytes` to the string `str`.
70-
*/
71-
private predicate covertsBytesToString(DataFlow::Node bytes, DataFlow::Node str) {
72-
bytes.getType().(Array).getElementType().(PrimitiveType).hasName("byte") and
73-
str.getType() instanceof TypeString and
74-
exists(MethodCall mc | mc = str.asExpr() | bytes.asExpr() = mc.getAnArgument())
75-
}
76-
7768
/**
7869
* A taint-tracking configuration for weak randomness.
7970
*/
@@ -88,8 +79,6 @@ module WeakRandomnessConfig implements DataFlow::ConfigSig {
8879
n1.asExpr() = n2.asExpr().(BinaryExpr).getAnOperand()
8980
or
9081
n1.asExpr() = n2.asExpr().(UnaryExpr).getExpr()
91-
or
92-
covertsBytesToString(n1, n2)
9382
}
9483
}
9584

0 commit comments

Comments
 (0)