Skip to content

Commit 8cd506e

Browse files
authored
Merge pull request #8874 from smowton/smowton/fix/insecure-cookies-look-through-named-constants
Java insecure cookies query: look through named constants
2 parents 2a8f179 + 8d70982 commit 8cd506e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

java/ql/src/Security/CWE/CWE-614/InsecureCookie.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ where
2020
not exists(Variable cookie, MethodAccess m |
2121
add.getArgument(0) = cookie.getAnAccess() and
2222
m.getMethod().getName() = "setSecure" and
23-
m.getArgument(0).(BooleanLiteral).getBooleanValue() = true and
23+
m.getArgument(0).(CompileTimeConstantExpr).getBooleanValue() = true and
2424
m.getQualifier() = cookie.getAnAccess()
2525
)
2626
select add, "Cookie is added to response without the 'secure' flag being set."
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Query `java/insecure-cookie` no longer produces a false positive if
5+
`cookie.setSecure(...)` is called passing a constant that always equals
6+
`true`.

0 commit comments

Comments
 (0)