Skip to content

Commit 2de1c1d

Browse files
authored
Merge branch 'main' into desimone/1638
2 parents 229ba3c + 463ea8f commit 2de1c1d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

content/docs/reference/cookies.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,26 @@ cookie:
162162

163163
If true, **Cookie HTTP Only** forbids JavaScript from accessing the cookie.
164164

165+
While the HttpOnly flag is enabled by default for security reasons, some users may choose to disable it for specific use cases that require JavaScript access to cookies. However, disabling HttpOnly cookies significantly increases security risks:
166+
167+
- **XSS Vulnerability**: Without the HttpOnly flag, cookies become accessible to JavaScript code, making them vulnerable to Cross-Site Scripting (XSS) attacks. Malicious scripts could steal session cookies and hijack user sessions.
168+
- **Client-Side Attacks**: Any compromised or malicious JavaScript running on the page can read and exfiltrate cookie values.
169+
- **Third-Party Script Risks**: If your application includes third-party JavaScript libraries or scripts, they would also have access to non-HttpOnly cookies.
170+
171+
:::warning Security Warning
172+
173+
Disabling the HttpOnly flag (`cookie_http_only: false`) is strongly discouraged and should only be done when absolutely necessary. If you must disable HttpOnly:
174+
175+
1. Ensure your application has robust XSS protection mechanisms
176+
2. Regularly audit all JavaScript code, including third-party dependencies
177+
3. Consider implementing additional security measures like Content Security Policy (CSP)
178+
4. Limit the scope and lifetime of non-HttpOnly cookies
179+
5. Monitor for suspicious activity that could indicate cookie theft
180+
181+
The security implications of disabling HttpOnly far outweigh most convenience benefits. Carefully evaluate whether your use case truly requires JavaScript cookie access before making this change.
182+
183+
:::
184+
165185
### How to configure {#cookie-http-only-how-to-configure}
166186

167187
<Tabs>

0 commit comments

Comments
 (0)