-
Notifications
You must be signed in to change notification settings - Fork 623
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(encoding/jsonc): avoid prototype pollution in Node.js and Browser #3077
Conversation
Not sure if this makes sense for the std. It seems to be making the code harder to read with very little gain for its intended place of consumption. I do see an argument for browsers since iirc this module is considered browser compatible but given that it is non-trivial to get this running directly in a browser due to typescript, I would not be concerned about Also, I'm personally -1 for adding a dependency to node here. |
We can use esb.deno.dev, deno.land/x/emit and dnt to run this module in the browser or Node.js. In my opinion, when it comes to code readability and security, security should take precedence. (For reference, the content of the fix is the same as the fix done in JSON5.) Also, the behavior in current browsers simply looks buggy. i want to fix this.
I agree with this. Edit: I have done this, and it works great. There is no dependency on Node.js anymore. |
Fixing for browser security makes sense to me |
Sorry about not having time to review this earlier. In its new form, this LGTM! My biggest concern before was regarding CI but now that this has been fixed, this seems like an obvious fix. |
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.
LGTM
related: CVE-2022-46175
Using
encoding/jsonc
with Node.js and browsers is currently vulnerable to prototype pollution (in the form described in the CVE-2022-46175).This PR changes the behavior of
jsonc.parse
when trying to set__proto__
as a key in Node.js and browsers.This PR does not change behavior when running in Deno. This is because
__proto__
has been removed within Deno and is already robust against prototype pollution attacks.