Medium severityJavaScript / TypeScriptAuthentication & SecretsMEDIUM confidence
Insecure Cookie Flags
A cookie is set without both httpOnly and secure flags, exposing it to theft via XSS or plaintext transport.
Standards mapping
- CWE
- CWE-1004: Sensitive Cookie Without 'HttpOnly' FlagCWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute
- OWASP Top 10
- A05:2021 - Security Misconfiguration
- OWASP ASVS
- V3.4.1 (L1)V3.4.2 (L1)
Vulnerable vs. safe
Flagged by this check
res.cookie("session", token);Passes - the safe pattern
res.cookie("session", token, { httpOnly: true, secure: true, sameSite: "strict" });Why it matters & how to fix it
A cookie is set without both httpOnly and secure flags, exposing it to theft via XSS or plaintext transport. Set { httpOnly: true, secure: true, sameSite: 'strict' } for session/auth cookies.
References
Rule ID integsec-js-insecure-cookie-flags - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Authentication & SecretsHardcoded JWT Secret
- JavaScript / TypeScript - Authentication & SecretsHardcoded Secret
- JavaScript / TypeScript - Authentication & SecretsJWT Algorithm None
- JavaScript / TypeScript - Authentication & SecretsJWT Decode Without Verify
- JavaScript / TypeScript - Authentication & SecretsTLS Verification Disabled
- Python - Authentication & SecretsDjango Hardcoded Secret Key