-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
noopener alone not allowed #3044
Comments
See #2022 (comment):
That information also violates the privacy of the user, and I don't think your opinion is the common one here about what people should do - referrers aren't reliable and anyone relying on that info is getting a very incomplete picture, no matter what you choose to do. You are welcome to disable the rule, of course. |
Hi @ljharb, I've read a lot of comments related to this here in the project, and it's not always obvious if the comments are referring to the use of At the time, you even had an opinion which is compatible with mine: #2022 (comment):
I agree with this. Both As for the privacy of the users, to be honest I think that is up for the developer and/or user to decide, together with the specific legal framework observed by the website owners. But even if that is up for discussion, I just don't think the rule is correct in saying there is a security risk even when |
The risk is as highlighted/referenced in my previous comment - that noopener isn't supported in as many browsers as noreferrer. |
The thing is: this rule only applies to If we really consider the Referer header to be dangerous (which it can be), then all external links should include However I understand that noopener is not supported on IE and if noreferrer has the same effect, then that is a good reason to still enforce noreferrer as a general precaution. But I think the lint message should tell that While looking though the source, I found that it's possible to set {
"extends": ["next", "next/core-web-vitals"],
"rules": {
"react/jsx-no-target-blank": ["error", {"allowReferrer": true}]
}
} While looking that up, I found that over the last 2 years, browsers started to imply There is also the much more granular Referrer-Policy header that can take care of it. |
@Nemo64 i'd be happy to review a PR that improves the error message, and points users to where they can read more about the nuance. |
Show different error messages depending on whether referrer is allowed; clarify about `noreferrer` only being necessary in older browsers. Closes jsx-eslint#3044.
Hi,
I've been reading the discussion surrounding noopener / noreferrer, including what was done in #2043.
However, I still find the behaviour strange.
Here is my link:
<a href="https://some-external-link.com" target="_blank" rel="noopener">Link</a>
I'm getting a warning:
Using target="_blank" without rel="noreferrer" is a security risk: see https://html.spec.whatwg.org/multipage/links.html#link-type-noopener react/jsx-no-target-blank
The html spec link redirects me to
noopener
documentation, and yet it is still requiring me to addnoreferrer
. As far as I understand, the use ornoreferrer
ornoopener
removes the security risk, so the rule should not be triggered if one of them is present (no matter which). In this case, since I'm usingnoopener
(thus removing the security risk), the warning should not be shown, imho.Why don't I use
noreferrer
? I think it's important for websites to know where their traffic is coming from, so I don't intend on hiding the referrer, and I don't think you should either. The referrer information helps bloggers and independent content creators properly monitor the traffic arriving to their websites.The text was updated successfully, but these errors were encountered: