redline
LowSecuritytarget-blank

target=_blank without rel

target=_blank without rel. Opens a new tab without rel="noopener".

This is how the comment reads inline, under the flagged line.

Why it matters

Older browsers give the opened page a handle to yours (window.opener) that can redirect it.

What to do

Add rel="noopener noreferrer".

Examples

Flagged
<a href={url} target="_blank">
Better
<a href={url} target="_blank" rel="noopener noreferrer">

What it catches

It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Markdown, JSON and text. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.

Flagged

<a href={u} target="_blank">x</a>

Left alone

<a href={u} target="_blank" rel="noopener">x</a>

Research

Raw HTML sinks (`innerHTML`, `dangerouslySetInnerHTML`) and `target="_blank"` without `rel`. Untrusted strings run as script, and an opened page can redirect yours.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "target-blank"
    ],
    "severity": {
      "target-blank": "medium"
    }
  }
}

Read the source or report a false positive.