FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/javascript/ql/src/DOM/TargetBlank.qhelp at codeql-cli/v2.19.1 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
467
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
javascript
/
ql
/
src
/
DOM
/
TargetBlank.qhelp
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (40 loc) · 1.68 KB
Breadcrumbs
codeql
/
javascript
/
ql
/
src
/
DOM
/
TargetBlank.qhelp
Copy path
File metadata and controls
49 lines (40 loc) · 1.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!
DOCTYPE
qhelp
PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<
qhelp
>
<
overview
>
<
p
>
HTML links that open in a new tab or window allow the target page to access the DOM
of the origin page using <
code
>window.opener</
code
> unless link type <
code
>noopener</
code
>
or <
code
>noreferrer</
code
> is specified. This is a potential security risk.
</
p
>
<
p
>
Note that only older browsers, where <
code
>target="_blank"</
code
> does not imply <
code
>rel="noopener"</
code
>,
are affected by this vulnerability. Modern browsers implicitly add <
code
>rel="noopener"</
code
> to
<
code
>target="_blank"</
code
> links.
Refer to the <
a
href
=
"
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#browser_compatibility
"
>browser compatibility section
on the anchor element</
a
> for details on which browsers implicitly add <
code
>rel="noopener"</
code
> to <
code
>target="_blank"</
code
> links.
</
p
>
</
overview
>
<
recommendation
>
<
p
>
Specify the link type by adding an attribute <
code
>rel="noopener noreferrer"</
code
>.
</
p
>
</
recommendation
>
<
example
>
<
p
>
In the following example, a JSX element is created that corresponds to an HTML
link opening the URL <
code
>http://example.com</
code
> in a new tab. Since it does
not specify a link type, that page will be able to access the DOM of the origin page.
</
p
>
<
sample
src
=
"
examples/TargetBlank.js
"
/>
<
p
>
To fix this vulnerability, add a <
code
>rel</
code
> attribute:
</
p
>
<
sample
src
=
"
examples/TargetBlankGood.js
"
/>
</
example
>
<
references
>
<
li
>Mathias Bynens: <
a
href
=
"
https://mathiasbynens.github.io/rel-noopener/
"
>About rel=noopener</
a
>.</
li
>
<
li
>Mozilla Developer Network: <
a
href
=
"
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
"
>HTML Anchor Element</
a
>.</
li
>
</
references
>
</
qhelp
>
Back
|
FazBrowse Home
|
New Git URL