You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The accumulator object used during query parsing (initialized here), is a regular JavaScript Object. This means that it all the default Object keys are valid keys:
As regular key-accessing is used, the prototype chain is followed, hence, the check here will not be undefined for those keys, and this assignment logic will be followed.
In other words, while there is a check for __proto__ and constructor to prevent prototype pollution (I presume), this does not solve the problem of accessing other keys in the object's prototype. A good solution would be to use Object.create(null) instead of {} to initialize object.
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered:
Environment
Node v23.10.0,
ufo
version 1.5.4.Reproduction
Describe the bug
The accumulator object used during query parsing (initialized here), is a regular JavaScript Object. This means that it all the default Object keys are valid keys:
As regular key-accessing is used, the prototype chain is followed, hence, the check here will not be undefined for those keys, and this assignment logic will be followed.
In other words, while there is a check for
__proto__
andconstructor
to prevent prototype pollution (I presume), this does not solve the problem of accessing other keys in the object's prototype. A good solution would be to useObject.create(null)
instead of{}
to initializeobject
.Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: