-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/update the content of HttpOnly Page #1038
base: master
Are you sure you want to change the base?
Fix/update the content of HttpOnly Page #1038
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the hyphen to asterisk changes can be reverted, along with the empty line insertion, and the removal of line feed at the end of the file.
Since Java Enterprise Edition 6 (JEE 6), which adopted Java Servlet 3.0 | ||
technology, it's programmatically easy to set the HttpOnly flag on a | ||
cookie. | ||
for more information , plwase check [Java EE to Jakarta EE Transition](https://jakarta.ee/about/faq/#what-is-the-java-ee-to-jakarta-ee-transition). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please
cookie.setHttpOnly(true); // Mark the cookie as HttpOnly | ||
response.addCookie(cookie); | ||
``` | ||
Moreover, since Jakarta EE 9, it's also declaratively easy to set the `HttpOnly` flag for session cookies by applying the following configuration in the deployment descriptor `WEB-INF/web.xml`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example seems the same as the v6 example, so saying since v9 is misleading
response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; HttpOnly"); | ||
|
||
import jakarta.servlet.http.Cookie; | ||
Cookie cookie = new Cookie("sessionId", "abc123"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like a practical example for a security community
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally the code seems exactly the same as above so why bother?? Why not make the other "since 8" and skip the 9 example?
In fact, the `setHttpOnly` and `isHttpOnly` methods are available in the [`jakarta.servlet.http.Cookie`](https://jakarta.ee/specifications/servlet/5.0/apidocs/jakarta/servlet/http/Cookie.html) interface, as well as for session cookies (`JSESSIONID`) using [`jakarta.servlet.SessionCookieConfig`](https://jakarta.ee/specifications/servlet/5.0/apidocs/jakarta/servlet/SessionCookieConfig.html): | ||
|
||
```java | ||
Cookie cookie = new Cookie("sessionId", "abc123"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like a practical example for a security community
@YourBroCode do you plan to finish this? |
update the content of HttpOnly Page according to the JEE 9 regarding cookie check.