Files
orca/mobile/patches/deepmerge@4.3.1.patch
Neil 9c7fe9793e fix(deps): backport minimatch, glob, and deepmerge security fixes (#37981)
Backport upstream matching and abort fixes plus safe deepmerge property handling across the independent workspaces. Includes installed-package regression tests and audit-tool fixture repair. Agent-reviewed at 83ca381d519e6247d7c1b3f0a52ce2907a9f9a19; CI aggregate passed. Version-based scanner alerts remain open pending documented disposition or compatible upstream releases.
2026-11-03 17:13:11 -08:00

100 lines
4.1 KiB
Diff

diff --git a/dist/cjs.js b/dist/cjs.js
--- a/dist/cjs.js
+++ b/dist/cjs.js
@@ -76,11 +76,16 @@ function propertyIsUnsafe(target, key) {
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
}
+// Own __proto__ keys must stay data, not replace the result's prototype.
+function setOwnValue(destination, key, value) {
+ Object.defineProperty(destination, key, { value: value, enumerable: true, writable: true, configurable: true })
+}
+
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
+ setOwnValue(destination, key, cloneUnlessOtherwiseSpecified(target[key], options));
});
}
getKeys(source).forEach(function(key) {
@@ -89,9 +94,9 @@ function mergeObject(target, source, options) {
}
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
+ setOwnValue(destination, key, getMergeFunction(key, options)(target[key], source[key], options));
} else {
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
+ setOwnValue(destination, key, cloneUnlessOtherwiseSpecified(source[key], options));
}
});
return destination
diff --git a/dist/umd.js b/dist/umd.js
--- a/dist/umd.js
+++ b/dist/umd.js
@@ -80,11 +80,16 @@
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
}
+ // Own __proto__ keys must stay data, not replace the result's prototype.
+ function setOwnValue(destination, key, value) {
+ Object.defineProperty(destination, key, { value: value, enumerable: true, writable: true, configurable: true })
+ }
+
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
+ setOwnValue(destination, key, cloneUnlessOtherwiseSpecified(target[key], options));
});
}
getKeys(source).forEach(function(key) {
@@ -93,9 +98,9 @@
}
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
+ setOwnValue(destination, key, getMergeFunction(key, options)(target[key], source[key], options));
} else {
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
+ setOwnValue(destination, key, cloneUnlessOtherwiseSpecified(source[key], options));
}
});
return destination
diff --git a/index.js b/index.js
--- a/index.js
+++ b/index.js
@@ -51,11 +51,16 @@ function propertyIsUnsafe(target, key) {
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
}
+// Own __proto__ keys must stay data, not replace the result's prototype.
+function setOwnValue(destination, key, value) {
+ Object.defineProperty(destination, key, { value: value, enumerable: true, writable: true, configurable: true })
+}
+
function mergeObject(target, source, options) {
var destination = {}
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)
+ setOwnValue(destination, key, cloneUnlessOtherwiseSpecified(target[key], options))
})
}
getKeys(source).forEach(function(key) {
@@ -64,9 +69,9 @@ function mergeObject(target, source, options) {
}
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options)
+ setOwnValue(destination, key, getMergeFunction(key, options)(target[key], source[key], options))
} else {
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options)
+ setOwnValue(destination, key, cloneUnlessOtherwiseSpecified(source[key], options))
}
})
return destination