-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
fix(vue-app): use mixin to provide this.$nuxt
#8068
Conversation
avoids prototype pollution on Vue closes nuxt#7696
Codecov Report
@@ Coverage Diff @@
## dev #8068 +/- ##
=======================================
Coverage 68.98% 68.98%
=======================================
Files 91 91
Lines 3847 3847
Branches 1047 1047
=======================================
Hits 2654 2654
Misses 969 969
Partials 224 224
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clarkdo @danielroe Can we add a SSR test to ensure this fix works? |
Are we okay with prototype pollution outside of a component instance? (I'm also aware that injected objects currently also appear to be shared across requests but I haven't yet verified that...) |
Actually I don't think is a prototype pollution as it's a very normal way in Vue plugin, the issue is that different ssr requests are sharing same Vue reference. |
Hi @danielroe , have you verified this fix in your project ? Are we OK to merge ? |
@clarkdo Looks good to me - apologies for the delay. (Didn't realise you were waiting on me 🤦) |
@danielroe No worries, thanks for the confirmation, I'll merge it now. |
@clarkdo @danielroe I think we shouldn't merge this PR. Mixin method is probably replaceable with simple getter and SSR tests aren't added |
I'll revert the pr.
Correct me if I misunderstood, I think we can't use getter like below, because it will still get new reference. get nuxt() {
return Vue.prototype.nuxt
} |
This is correct - it results in the same original issue if we are using getters in the way that the plugins do. |
Reverted and new pr is here #8132 |
@danielroe Not directly returning same reference 🙈 But we can pass and read same reference from instance options (similar to plugins |
@pi0 What about adding |
Types of changes
Description
avoids prototype pollution on the Vue prototype
closes #7696
Checklist: