Skip to content

feat(html): detect anchors with target=_blank lacking rel=noopener noreferrer (CWE-1022) - #132

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/html-anchor-missing-noopener
Open

feat(html): detect anchors with target=_blank lacking rel=noopener noreferrer (CWE-1022)#132
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/html-anchor-missing-noopener

Conversation

@ai-anant

Copy link
Copy Markdown

Adds a new html/ rule tree with one rule:

codevigilant.html.reversetabnabbing.anchor.missing-noopener (severity LOW, CWE-1022)

Pattern: an <a> tag with target="_blank" whose rel attribute does not include noopener or noreferrer. The opened page then retains a window.opener reference to the linking page and can navigate it (reverse tabnabbing / tab hijacking).

  • Positive repro (anchor with target=_blank and no rel) → rule fires
  • Negative repros (rel=noopener, rel=noreferrer, rel="noopener noreferrer", no target attribute) → rule does not fire
  • Validated with semgrep --validate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant