Skip to content

Conversation

jankapunkt
Copy link
Member

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:

  • validate
  • clean
  • autoValue
  • computed fields

We need to test, where the async pattern is breaking current setups and document these changes with examples in a migration guide.

@jankapunkt jankapunkt changed the title Migration: full async support WIP Migration: full async support Aug 21, 2025
merge(destination[prop], source[prop])
} else {
destination[prop] = source[prop];
destination[prop] = source[prop]

Check warning

Code scanning / CodeQL

Prototype-polluting function Medium

Properties are copied from
source
to
destination
without guarding against prototype pollution.

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.


Suggested changeset 1
lib/utility/merge.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lib/utility/merge.js b/lib/utility/merge.js
--- a/lib/utility/merge.js
+++ b/lib/utility/merge.js
@@ -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 &&
EOF
@@ -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 &&
Copilot is powered by AI and may make mistakes. Always verify output.
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