Missing Secure option in cookie configuration

  • Rule ID: javascript_express_insecure_cookie
  • Languages: javascript
  • Source: insecure_cookie.yml

Description

A cookie that is configured to be secure ensures that a client will only send the cookie to the server when HTTPS is being used. This prevents the cookie from being observed by unauthorized third parties.

Remediations

✅ Set secure values to true to force cookies to only send over HTTPS.

  cookie({{ secure: true }})

Resources

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=javascript_express_insecure_cookie

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

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