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

fix: prevent prototype pollution in rare error-cases #923

Merged
merged 1 commit into from Jan 9, 2023

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jan 9, 2023

If a user-provided search parameter is used to instantiate search parameters, it was possible to construct it in such a way that constructor.prototype is attempted to be written. That throws an error, but if the error would be caught, the resulting injection still happened.

This PR fixes that (small) vulnerability by ensuring constructor, is skipped, just like __proto__.

fixes #922

This is similar/a follow-up to #880

If a user-provided search parameter is used to instantiate search parameters, it was possible to construct it in such a way that `constructor.prototype` is attempted to be written. That throws an error, but if the error would be caught, the resulting injection still happened.

This PR fixes that (small) vulnerability by ensuring `constructor`, is skipped, just like `__proto__`.

fixes #922

This is similar/a follow-up to #880
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 9, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 776dff2:

Sandbox Source
javascript-helper-app Configuration
InstantSearch.js Configuration

Copy link
Member

@dhayab dhayab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Haroenv Haroenv changed the title fix(constructor): prevent prototype pollution in rare error-cases fix: prevent prototype pollution in rare error-cases Jan 9, 2023
@Haroenv Haroenv merged commit 7ae16ea into develop Jan 9, 2023
@Haroenv Haroenv deleted the fix/vuln-error branch January 9, 2023 09:27
Haroenv added a commit that referenced this pull request Jan 9, 2023
 * feat: update Algolia logo (#918) 58e0e58
 * fix: prevent prototype pollution in rare error-cases (#923) 7ae16ea, closes #922
 * fix(answers): deprecate findAnswers (#919) 0711861
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
…search-helper-js#923)

If a user-provided search parameter is used to instantiate search parameters, it was possible to construct it in such a way that `constructor.prototype` is attempted to be written. That throws an error, but if the error would be caught, the resulting injection still happened.

This PR fixes that (small) vulnerability by ensuring `constructor`, is skipped, just like `__proto__`.

fixes algolia/algoliasearch-helper-js#922

This is similar/a follow-up to algolia/algoliasearch-helper-js#880
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
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.

Prototype pollution found in merge.js
2 participants