Sensitive cookie without HttpOnly attribute
Description
The cookie was transmitted in a Set-Cookie
header without the HttpOnly
attribute set.
To prevent JavaScript being able to access the cookie value - usually via document.cookies
- all
cookies that are used for authorization should have the HttpOnly
attribute
set.
Remediation
Most web application frameworks allow configuring how cookies are sent to user-agents. Consult your framework’s documentation for more information on how to enable various security directives when assigning cookies to clients.
If the application is assigning cookies via writing to the response headers directly, ensure all responses include
the HttpOnly
attribute. By enabling this protection, the application is able to mitigate the impact of
certain Cross-Site Scripting (XSS) attacks.
Example:
Set-Cookie: {cookie_name}=<random secure value>; HttpOnly
Details
ID | Aggregated | CWE | Type | Risk |
---|---|---|---|---|
1004.1 | false | 1004 | Passive | Low |
Links
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support