Skip to content
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

Unique Indices will fail for some user input #839

Closed
radex opened this issue May 28, 2020 · 2 comments · Fixed by #847
Closed

Unique Indices will fail for some user input #839

radex opened this issue May 28, 2020 · 2 comments · Fixed by #847

Comments

@radex
Copy link
Contributor

radex commented May 28, 2020

because of this:

    function UniqueIndex(uniqueField) {
      this.keyMap = {};
    };
    /* snip */
    UniqueIndex.prototype.get = function (key) {
      return this.keyMap[key];
    };

collection.by(key, xxx) cannot have any unsanitized xxx input or it might fail. For example, this.keyMap['hasOwnProperty'] will always be truthy.

One simple solution is to use Object.create(null) instead of {}, so that the object has no prototype.

@stale
Copy link

stale bot commented Jul 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 27, 2020
@radex
Copy link
Contributor Author

radex commented Jul 27, 2020

no, bot

@stale stale bot removed the wontfix label Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant