-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
chore: strongly typed forms #592
base: main
Are you sure you want to change the base?
Conversation
curr = curr[parts[i]]; | ||
} | ||
} | ||
curr[parts[parts.length - 1]] = value; |
Check warning
Code scanning / CodeQL
Prototype-polluting function Medium
here
curr
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that the path
parameter does not contain dangerous keys like __proto__
or constructor
. We can achieve this by adding a check to block these keys before proceeding with the assignment. This will prevent prototype pollution while maintaining the existing functionality.
-
Copy modified lines R46-R48 -
Copy modified lines R55-R57
@@ -45,2 +45,5 @@ | ||
for (let i = 0; i < parts.length - 1; i++) { | ||
if (parts[i] === "__proto__" || parts[i] === "constructor") { | ||
return; | ||
} | ||
if (Array.isArray(curr)) { | ||
@@ -51,3 +54,5 @@ | ||
} | ||
curr[parts[parts.length - 1]] = value; | ||
if (parts[parts.length - 1] !== "__proto__" && parts[parts.length - 1] !== "constructor") { | ||
curr[parts[parts.length - 1]] = value; | ||
} | ||
}; |
No description provided.