Skip to content
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

Fix tab nabbing vulnerability in formatted links #2674

Merged
merged 1 commit into from Sep 9, 2019

Conversation

d4l-w4r
Copy link
Contributor

@d4l-w4r d4l-w4r commented Jul 6, 2019

  • Add attribute rel="noopener noreferrer" to tags created by formats/link.js
  • Make unit tests for links expect rel attribute

The vulnerability described in #2438 was not fully fixed with PR #2439 .
Using quill in readonly mode to display content still results in vulnerable anchor tags, because
the create function in formats/link.js sets target="_blank" but not rel="noopener noreferrer".

This pull request in combination with #2439 mitigates the tab nabbing vulnerability.

- Add attribute rel="noopener noreferrer"
  to <a> tags created by formats/link.js
- Make unit tests for links expect rel
  attribute
@Jamesking56
Copy link

@jhchen can we get this merged and released please?

@@ -4,6 +4,7 @@ class Link extends Inline {
static create(value) {
const node = super.create(value);
node.setAttribute('href', this.sanitize(value));
node.setAttribute('rel', 'noopener noreferrer');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is noreferrer required? If I'm correct this was a workaround for FF, which was fixed in FF 52. This will cause issues with analytics reporting where traffic came from

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm 🤔 I think it would be best as a config option to set that

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using a property such as Link.REL = "noopener"; be efficient?

Copy link
Contributor Author

@d4l-w4r d4l-w4r Jul 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to caniuse, the rel=noopener attribute is not supported by IE11, with rel=noreferrer at least being supported in Win 10 creators update versions of IE11. That's why I picked both attributes here.

This will cause issues with analytics reporting where traffic came from

Personally I would consider this a feature. But I could understand if you didn't want to make this decision as part of your library.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my apologies, I should have checked IE support! This is good to go then. Thanks 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome :)
Please note though, that for a release that fixes the complete vulnerability, this commit as well as #2439 have to be included.

@tirsoh
Copy link

tirsoh commented Jul 30, 2019

@jl-welch when will there be a release with these fixes? We have a security finding in our application because of this.

@tirsoh
Copy link

tirsoh commented Aug 15, 2019

Can we please get a release on this fix??

@vinayakkulkarni
Copy link

npm audit link for those who want it : https://www.npmjs.com/advisories/1039

@harkylton
Copy link

@jhchen @Jamesking56 @jl-welch Hey guys! Thanks for all the good work. What's the status of getting this released?

@Jamesking56
Copy link

@harkylton I think @jhchen is the only one who can merge + deploy and he hasn't responded to this in a long while...

@pierluca
Copy link

I'm also very interested in seeing this merged and released.
It came up in one of our security audits as well.

@srkrish2
Copy link

Same here, the sooner the fix is merged and released the better.

@caleb531
Copy link

+1 Same here, I am also looking to apply this patch to my Quill-based application, but would prefer to specify an actual release number in my package.json (as opposed to a specific git commit).

@Jamesking56
Copy link

Jamesking56 commented Sep 2, 2019

I have managed to make a custom fork with the patches included. It is still versioned as 1.3.6 but includes both tabnapping patches (this PR and #2439).

To install just run npm i quill@https://github.com/momentumstudi0/quill.git#1.3.6 --save

@tirsoh
Copy link

tirsoh commented Sep 2, 2019 via email

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.

None yet