-
Notifications
You must be signed in to change notification settings - Fork 21
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] Prevent overriding of build-in properties by default #19
Conversation
.travis.yml
Outdated
- "0.8" | ||
before_install: | ||
- 'if [ "${TRAVIS_NODE_VERSION}" == "0.8" ]; then npm install -g [email protected]; fi' | ||
- "5" |
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.
Old and no longer supported, I'd remove it.
// methods like `toString` or __proto__ are not overriden by malicious | ||
// querystrings. | ||
// | ||
if (key in result) continue; |
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.
We should be safe even without this, as all of them can be safely overridden, with the exception of __proto__
but setting it to a string has no effect.
That said I'm also ok with this.
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.
Without the key in result
check, the test will fail because toString() can be overridden.
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.
Yes, that's my point, if your query string has a parameter called toString
the expected behaviour is probably to find that parameter in the parsed object.
It overrides the toString
inherited by Object.prototype
but that another issue. I mean ideally the parsed object should not inherit from Object.prototype
at all but we can't use Object.create(null)
due to old browsers support.
This needs a major version bump. |
Updated 'querystringify' to fix [WS-2018-0588 vulnerability](unshiftio/querystringify#19)
See the link below for more details: unshiftio/querystringify#19
Currently, it's possible to override built-in properties of the resulting query string object if a malicious string is inserted in the query string, for example
?toString&
will set thetoString
method of the object to thetrue
boolean. This patch ensures that we never override built-in properties or previously set properties.