Leakage of sensitive data in cookie

  • Rule ID: python_django_cookies
  • Languages: python
  • Source: cookies.yml

Description

Storing sensitive data in cookies can lead to a data breach. This vulnerability occurs when sensitive information is stored in browser cookies, putting it at risk of unauthorized access.

Remediations

  • Do not store sensitive data in unencrypted cookies. This practice can expose sensitive information to potential security threats.
    HttpResponse.set_cookie("user", "john@doe.com", ...) # unsafe
  • Do use encrypted cookies to protect sensitive data stored in cookies.
    HttpResponse.set_signed_cookie("user", "john@doe.com", ...)

References

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=python_django_cookies

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=python_django_cookies