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: Prototype Pollution Vulnerability Affecting redoc <=2.2.0 #2638

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

KsAkira10
Copy link
Contributor

#2499

What/Why/How?

This PR fixes the security flaw in the "mergeObjects" function that is in this issue 2499

Reference

#2499

Tests

test('should prevent prototype pollution', () => {
        const target = {};
        const source = JSON.parse('{"__proto__": {"polluted": "yes"}}');

        mergeObjects(target, source);

        expect(({} as any).polluted).toBeUndefined();
 });

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested
  • All new/updated code is covered with tests

@KsAkira10 KsAkira10 requested a review from a team as a code owner January 2, 2025 16:40
Copy link
Collaborator

@AlexVarchuk AlexVarchuk left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexVarchuk
Copy link
Collaborator

@KsAkira10 thank you for the contribution. Merge it when you are ready.

@KsAkira10 KsAkira10 closed this Jan 28, 2025
@KsAkira10 KsAkira10 reopened this Jan 28, 2025
@KsAkira10
Copy link
Contributor Author

image

I'm without permission

@AlexVarchuk
Copy link
Collaborator

Oh, sorry. I'll merge

@AlexVarchuk AlexVarchuk merged commit 153ec7a into Redocly:main Jan 28, 2025
3 checks passed
@KsAkira10 KsAkira10 deleted the fix/2499-pollution-vulnerability branch January 28, 2025 21:30
@KsAkira10 KsAkira10 restored the fix/2499-pollution-vulnerability branch January 28, 2025 21:31
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