Skip to content

Commit 04f1fe5

Browse files
authored
Update Test.java
1 parent f3f8f35 commit 04f1fe5

File tree

1 file changed

+10
-0
lines changed
  • java/ql/test/query-tests/security/CWE-311/CWE-614/semmle/tests

1 file changed

+10
-0
lines changed

java/ql/test/query-tests/security/CWE-311/CWE-614/semmle/tests/Test.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,15 @@ public static void test(HttpServletRequest request, HttpServletResponse response
8484
response.addCookie(cookie);
8585
}
8686

87+
{
88+
// GOOD: set secure flag in call to `createSecureCookie`
89+
response.addCookie(createSecureCookie());
90+
}
91+
}
92+
93+
private static Cookie createSecureCookie() {
94+
Cookie cookie = new Cookie("secret", "fakesecret");
95+
cookie.setSecure(constTrue);
96+
return cookie;
8797
}
8898
}

0 commit comments

Comments
 (0)