Missing Secure option in cookie configuration
- Rule ID: python_django_cookie_missing_secure
- Languages: python
- Source: cookie_missing_secure.yml
Description
Not setting the "Secure" attribute in cookie configuration can lead to unauthorized third-party access. This attribute, when enabled, ensures cookies are sent to the server only over HTTPS, enhancing security by preventing potential eavesdropping.
Remediations
- Do set the
secure
attribute totrue
to enforce the transmission of cookies over HTTPS only.response.set_cookie(secure=True)
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_cookie_missing_secure
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=python_django_cookie_missing_secure