Skip to content
This repository was archived by the owner on Feb 27, 2022. It is now read-only.

Fixed handling of parameters with names that are keys in Object.prototype. #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MaxNanasy
Copy link

In the current code, if a query string parameter has a name with a key in Object.prototype, then the query string parse logic will treat the existing value as if it had been passed first in the query string.

Example:
Expected behavior: 'toString=bar' => { toString: 'bar' }
Actual behavior: 'toString=bar' => { toString: [Object.prototype.toString, 'bar'] }

This commit changes the existing parameter check to use Object.prototype.hasOwnProperty, which prevents influence from Object.prototype's keys.

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.

1 participant