Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
SESSION_COOKIE_SECURE = False lets the session cookie travel over plain HTTP where it can be sniffed on the wire, and SESSION_COOKIE_HTTPONLY = False exposes it to JavaScript so an XSS payload can read and exfiltrate it; the REMEMBER_COOKIE_* flags do the same for Flask-Login's long-lived remember-me token (CWE-614, OWASP A05:2021). Keep these True (or drive them from an environment check), e.g. app.config["SESSION_COOKIE_SECURE"] = True and app.config["SESSION_COOKIE_HTTPONLY"] = True.
VULNERABLE
vulnerable.py
from flask import Flaskapp = Flask(__name__)# Subscript form on app.config — missed by the bare-assignment rule.# ruleid: auth.py.flask.session-cookie-insecureapp.config['SESSION_COOKIE_SECURE'] = False# ruleid: auth.py.flask.session-cookie-insecureapp.config['SESSION_COOKIE_HTTPONLY'] = False# ruleid: auth.py.flask.session-cookie-insecureapp.config['REMEMBER_COOKIE_SECURE'] = False# ruleid: auth.py.flask.session-cookie-insecureapp.config['REMEMBER_COOKIE_HTTPONLY'] = False# Keyword form via config.update(...).# ruleid: auth.py.flask.session-cookie-insecureapp.config.update(SESSION_COOKIE_SECURE=False, SESSION_COOKIE_SAMESITE="Lax")# ruleid: auth.py.flask.session-cookie-insecureapp.config.update(REMEMBER_COOKIE_SECURE=False)
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.