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: only throw error on field with annotation #274

Closed
wants to merge 1 commit into from

Conversation

Skn0tt
Copy link
Collaborator

@Skn0tt Skn0tt commented Oct 30, 2023

This comes out of the discussion in #267. We can narrow down the cases where an error is thrown. It's only necessary if the polluting key results in an annotation, in all other cases there's no risk for prototype pollution.

@Skn0tt Skn0tt self-assigned this Oct 30, 2023
@@ -1059,7 +1059,13 @@ test.each(['__proto__', 'prototype', 'constructor'])(
forbidden => {
expect(() => {
SuperJSON.serialize({
[forbidden]: 1,
[forbidden]: 1, // doesn't need entry in `meta`, so it's not a risk
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jonluca I believe this test case should cover your example from #267 (comment).

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.

1 participant