# Permissive HTTP Only option in cookie configuration

## Overview

* **Rule ID**: `java_lang_cookie_with_http_only_false`
* **Applicable Languages**: Java
* **Weakness ID**: CWE-1004

## Description

Failing to set the HTTP Only option to true in cookie configuration exposes your application to attacks, enabling client-side scripts to access cookie values. This vulnerability can result in unauthorized access or exploits.

## Remediation Guidelines

* **Set** `HttpOnly` to `true` for cookies to prevent client-side scripts from accessing cookie values. This step is crucial for enhancing your application's security by restricting access to sensitive cookie data.

  ```java
  cookie.setHttpOnly(true);
  ```

## References

* [**CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag**](https://cwe.mitre.org/data/definitions/1004.html)
* [**A05:2021 - Security Misconfiguration**](https://owasp.org/Top10/A05_2021-Security_Misconfiguration/)

## Configuration

To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our [**SAST TOOL**](https://scopy.sec1.io/login)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sec1.io/user-docs/4-sast/2-java/permissive-http-only-option-in-cookie-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
