> For the complete documentation index, see [llms.txt](https://docs.sec1.io/user-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sec1.io/user-docs/4-sast/2-java/leakage-of-sensitive-data-in-cookie.md).

# Leakage of sensitive data in cookie

## Overview

* **Rule ID**: `java_lang_cookie_leak`
* **Applicable Languages**: Java
* **Weakness ID**: CWE-315

## Description

Leakage of sensitive data through cookies can result in a data breach. This vulnerability arises when sensitive information is stored in browser cookies, making it susceptible to unauthorized access.

## Remediation Guidelines

* **Do not** store sensitive data in unencrypted cookies, as it can expose this information to potential security threats.

  ```java
  Cookie cookie = new Cookie("user", user.email);
  ```

## References

* [**CWE-315: Cleartext Storage of Sensitive Information in a Cookie**](https://cwe.mitre.org/data/definitions/315.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)
