Skip to content

Commit 45ce988

Browse files
authored
Merge pull request #16002 from erik-krogh/tarBlank
JS: change the precision of the `js/unsafe-external-link` query to `low`
2 parents d9b0a59 + 7d96818 commit 45ce988

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

javascript/ql/src/DOM/TargetBlank.qhelp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ of the origin page using <code>window.opener</code> unless link type <code>noope
99
or <code>noreferrer</code> is specified. This is a potential security risk.
1010
</p>
1111

12+
<p>
13+
Note that only older browsers, where <code>target="_blank"</code> does not imply <code>rel="noopener"</code>,
14+
are affected by this vulnerability. Modern browsers implicitly add <code>rel="noopener"</code> to
15+
<code>target="_blank"</code> links.
16+
Refer to the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#browser_compatibility">browser compatibility section
17+
on the anchor element</a> for details on which browsers implicitly add <code>rel="noopener"</code> to <code>target="_blank"</code> links.
18+
</p>
19+
1220
</overview>
1321
<recommendation>
1422

javascript/ql/src/DOM/TargetBlank.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* security
1111
* external/cwe/cwe-200
1212
* external/cwe/cwe-1022
13-
* @precision very-high
13+
* @precision low
1414
*/
1515

1616
import javascript
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: queryMetadata
3+
---
4+
* The `@precision` of the `js/unsafe-external-link` has been reduced to `low` to reflect the fact that modern browsers do not expose the opening window for such links. This mitigates the potential security risk of having a link with `target="_blank"`.

0 commit comments

Comments
 (0)