-
Notifications
You must be signed in to change notification settings - Fork 48
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
Security Fix for Prototype Pollution - huntr.dev #107
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3de26e9
Fix Prototype Pollution
alromh87 e18b903
Merge pull request #1 from alromh87/master
JamieSlome 432ea9e
Update index.ts
a970280
Amended fix to prevent polluting prototype instead of throwing error …
JamieSlome 9c5ec13
Fixing CI/CD linting checks.
JamieSlome 7c6fdda
Running regression test as a function call instead of expression.
JamieSlome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
after this call, shouldn't
expect(i18n.getLocale()).to.have.property('polluted')
pass as well?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.
@ljharb - before the fix, this may have been the case. However, after running the test suite with your suggested test, the following is returned:
If the suggested expect() statement passed, wouldn't this suggest that the prototype has been polluted?
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.
No, it would suggest that the locale object was properly updated.
I think the solution here isn't to disrupt usage of a string
__proto__
, but instead, to "salt" each locale name with a character that couldn't conflict with anything built-in. I usually use$
.ie, every get and set of a locale name should quietly stick a "$" in front. That way it'll be impossible to collide with the name of any builtin.
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.
@ljharb - okay, we will take another look at this, and see if we can salt each locale name as suggested with a non-disruptive character.
Cheers! 🍰