Skip to content

Commit 7bc9078

Browse files
committed
Fix tests
1 parent 3a5d711 commit 7bc9078

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

java/ql/test/query-tests/security/CWE-330/WeakRandomCookies.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ public void doGet() {
1919
int c = r.nextInt();
2020
// BAD: The cookie value may be predictable.
2121
Cookie cookie = new Cookie("name", Integer.toString(c)); // $hasWeakRandomFlow
22+
cookie.setValue(Integer.toString(c)); // $hasWeakRandomFlow
23+
24+
io.netty.handler.codec.http.Cookie nettyCookie =
25+
new io.netty.handler.codec.http.DefaultCookie("name", Integer.toString(c)); // $hasWeakRandomFlow
26+
nettyCookie.setValue(Integer.toString(c)); // $hasWeakRandomFlow
27+
io.netty.handler.codec.http.cookie.Cookie nettyCookie2 =
28+
new io.netty.handler.codec.http.cookie.DefaultCookie("name", Integer.toString(c)); // $hasWeakRandomFlow
29+
nettyCookie2.setValue(Integer.toString(c)); // $hasWeakRandomFlow
2230

2331
Encoder enc = null;
2432
int c2 = r.nextInt();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/apache-commons-lang3-3.7:${testdir}/../../../stubs/esapi-2.0.1
1+
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/apache-commons-lang3-3.7:${testdir}/../../../stubs/esapi-2.0.1:${testdir}/../../../stubs/netty-4.1.x

java/ql/test/stubs/netty-4.1.x/io/netty/handler/codec/http/Cookie.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/netty-4.1.x/io/netty/handler/codec/http/DefaultCookie.java

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)