Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

[Fix] setLocale: do not allow prototype pollution #2

Merged
merged 2 commits into from
Oct 28, 2020
Merged

[Fix] setLocale: do not allow prototype pollution #2

merged 2 commits into from
Oct 28, 2020

Conversation

ljharb
Copy link

@ljharb ljharb commented Oct 28, 2020

📊 Metadata *

Bounty URL: https://www.huntr.dev/bounties/1-npm-yup

⚙️ Description *

This uses a null object as the base locale data, so it doesn't have a prototype to pollute.

💻 Technical Description *

Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects.
JavaScript allows all Object attributes to be altered, including their magical attributes such as proto, constructor and prototype.
An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values.
Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain.

🐛 Proof of Concept (PoC) *

See tests.

🔥 Proof of Fix (PoF) *

See tests.

👍 User Acceptance Testing (UAT)

See tests. I also fixed the overarching test suite, which was only running a single test.

@huntr-helper
Copy link
Member

Congratulations ljharb - your fix has been selected! 🎉

Thanks for being part of the community & helping secure the world's open source code.
If you have any questions, please respond in the comments section, or hit us up on Discord. Your bounty is on its way - keep hunting!

Come join us on Discord

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants