Merge pull request #11549 from mbaluda/mbaluda/insecure-cookie

Java: Support interprocedural setting of cookie security
This commit is contained in:
Tony Torralba
2022-12-07 12:14:46 +01:00
committed by GitHub
3 changed files with 38 additions and 11 deletions

View File

@@ -84,5 +84,15 @@ class Test {
response.addCookie(cookie);
}
{
// GOOD: set secure flag in call to `createSecureCookie`
response.addCookie(createSecureCookie());
}
}
private static Cookie createSecureCookie() {
Cookie cookie = new Cookie("secret", "fakesecret");
cookie.setSecure(constTrue);
return cookie;
}
}