diff --git a/dist/index.js b/dist/index.js index 46abc02..6fbae39 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3204,7 +3204,7 @@ function copyFile(srcFile, destFile, force) { var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.21'; + var VERSION = '4.17.23'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -6958,7 +6958,7 @@ function copyFile(srcFile, destFile, force) { if (isArray(iteratee)) { return function(value) { return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); - } + }; } return iteratee; }); @@ -7562,8 +7562,47 @@ function copyFile(srcFile, destFile, force) { */ function baseUnset(object, path) { path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; + + // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg + var index = -1, + length = path.length; + + if (!length) { + return true; + } + + var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function'); + + while (++index < length) { + var key = path[index]; + + // skip non-string keys (e.g., Symbols, numbers) + if (typeof key !== 'string') { + continue; + } + + // Always block "__proto__" anywhere in the path if it's not expected + if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) { + return false; + } + + // Block "constructor.prototype" chains + if (key === 'constructor' && + (index + 1) < length && + typeof path[index + 1] === 'string' && + path[index + 1] === 'prototype') { + + // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a') + if (isRootPrimitive && index === 0) { + continue; + } + + return false; + } + } + + var obj = parent(object, path); + return obj == null || delete obj[toKey(last(path))]; } /** diff --git a/package-lock.json b/package-lock.json index 3fe0630..cca5137 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", - "lodash": "^4.17.21" + "lodash": "^4.17.23" }, "devDependencies": { "@jest/globals": "^29.7.0", @@ -4390,9 +4390,10 @@ } }, "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "license": "MIT" }, "node_modules/lodash.memoize": { "version": "4.1.2", diff --git a/package.json b/package.json index 20bb05c..267029e 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", - "lodash": "^4.17.21" + "lodash": "^4.17.23" }, "devDependencies": { "@jest/globals": "^29.7.0",