VBC-950: window-open-without-noopener
errorCategory: security
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .jsx, .astro
Scope: source code only, ignoring anything inside strings and comments
Tags: security
What it reports
window.open() at line {line} without 'noopener'. The page it opens gets a handle on this one and can navigate it. Pass 'noopener' in the third argument, or keep the handle deliberately if the code needs it.
Flagged
js
window.open(url, '_blank');js
window.open(`${base}/issues/new`, '_blank')js
onClick={() => window.open(previewUrl, '_blank')}Not flagged
js
window.open(url, '_blank', 'noopener');js
window.open(target, "_blank", "noopener,noreferrer");js
const win = window.open('', '_blank');js
const win = window.open("about:blank");js
const win = window.open();js
popup.close();Pattern
regex
window\.open\(\s*(?!\))(?!['"`]\s*['"`])(?!['"`]about:blank)(?![^\n]*noopener)