-
-
Notifications
You must be signed in to change notification settings - Fork 164
WIP Migration: full async support #752
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
base: master
Are you sure you want to change the base?
Conversation
All errors are fixed expect some regarding lib/SimpleSchema.js and its class fields and static properties which are recents syntax updates
WIP - make simple-schema fully Async
merge(destination[prop], source[prop]) | ||
} else { | ||
destination[prop] = source[prop]; | ||
destination[prop] = source[prop] |
Check warning
Code scanning / CodeQL
Prototype-polluting function Medium
source
destination
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the prototype pollution vulnerability, we should block all dangerous property names from being merged into the destination object. Specifically, we should skip any property named __proto__
, constructor
, or prototype
during the merge. This can be done by adding a check at the start of the property loop to return
early if the property name matches any of these. The fix should be applied in the merge
function in lib/utility/merge.js
, specifically in the property iteration block (lines 13–27). No new imports or methods are needed.
-
Copy modified line R14
@@ -11,7 +11,7 @@ | ||
export default function merge (destination, ...sources) { | ||
sources.forEach((source) => { | ||
Object.keys(source).forEach((prop) => { | ||
if (prop === '__proto__') return // protect against prototype pollution | ||
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return // protect against prototype pollution | ||
if ( | ||
source[prop] && | ||
source[prop].constructor && |
Based on @vparpoil last PR this is going to continue full async support. This will be breaking, so a new major version will be introduced.
The following parts will be async:
We need to test, where the async pattern is breaking current setups and document these changes with examples in a migration guide.