VBC-011: document-cookie-direct
warningCategory: security
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .astro
Scope: source code only, ignoring anything inside strings and comments
Tags: security clean-code
What it reports
Direct document.cookie write at line {line}. Manual cookie manipulation is error-prone and easy to misconfigure. Use a cookie library that enforces proper security flags (HttpOnly, Secure, SameSite) by default.
Flagged
js
document.cookie = "session=abc";Not flagged
js
if (document.cookie === "") { init(); }Pattern
regex
document\.cookie\s*=(?!=)