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

Fix code scanning alert no. 2: Prototype-polluting function #712

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

lindluni
Copy link
Contributor

Fixes https://github.com/github/safe-settings/security/code-scanning/2

To fix the prototype pollution vulnerability, we need to ensure that properties like __proto__ and constructor are not merged into the modifications, additions, or deletions objects. This can be achieved by adding checks to skip these properties during the merge process.

The best way to fix the problem without changing existing functionality is to add a condition to skip these properties in the compareDeep method. Specifically, we will add a check before processing each key to ensure it is not __proto__ or constructor.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@lindluni lindluni marked this pull request as ready for review December 16, 2024 03:57
@Copilot Copilot bot review requested due to automatic review settings December 16, 2024 03:57

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

lib/mergeDeep.js:95

  • The added condition correctly prevents prototype pollution by skipping the __proto__ and constructor properties during the merge process.
if (key === "__proto__" || key === "constructor") {

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@decyjphr
Copy link
Collaborator

Thanks @lindluni

@decyjphr decyjphr merged commit acddf25 into main-enterprise Dec 17, 2024
5 checks passed
@lindluni lindluni deleted the alert-autofix-2 branch December 26, 2024 14:15
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 this pull request may close these issues.

2 participants