fix(security): [Aikido] [SEC-400, SEC-292, SEC-464, SEC-478, SEC-527, SEC-542, SEC-521, SEC-604] Fix 1 critical issue in tough-cookie and 52 other issues - #12
Open
Conversation
… SEC-521, SEC-604] update dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade dependencies to fix critical RCE vulnerabilities in Handlebars and Lodash template injection, prototype pollution in tough-cookie, and insufficient randomness in form-data. This update includes breaking changes that require manual migration.
js-yaml (3.14.0 => 4.3.0)
Where your code is affected:
lib/settings/settings.js:113- usesyaml.safeLoad(settings)lib/configuration/configuration.js:161- usesyaml.safeLoad(content)lib/configuration/configuration.js:181- usesyaml.safeLoad(orgConfig)__fixtures__/unit/helper.js:27- usesyaml.safeLoad(configString)Multiple test files use
yaml.safeLoad()throughoutImpact:
The
yaml.safeLoad()method has been deprecated in js-yaml 4.x and replaced withyaml.load(). All calls toyaml.safeLoad()will fail as the method no longer exists.Remediation:
Replace all instances of
yaml.safeLoad()withyaml.load()throughout the codebase (settings.js, configuration.js, helper.js, and test files).handlebars (4.7.7 => 4.7.9)
Where your code is affected:
lib/actions/handlebars/populateTemplate.js:5-50- registers multiple custom helpers and useshandlebars.compile()lib/actions/merge.js:3,15,19- useshandlebars.compile()for commit title and message templatesImpact:
Security fixes in 4.7.9 may restrict previously allowed behavior in template compilation. While the basic
compile()usage should work, the security restrictions could affect template processing if any templates use patterns that are now blocked.Remediation:
Test all handlebars template compilation thoroughly, especially custom helpers (
breaklines,toUpperCase,formatDate,displaySettings,ifEquals,statusIcon) and template usage in merge actions to ensure security restrictions don't break functionality.pino (8.19.0 => 10.1.1)
Where your code is affected:
package.json:34- specifies Node.js engine as^20Pino is used indirectly through probot dependency
Impact:
Pino 10.x drops support for Node.js 18. The codebase currently requires Node.js ^20, so this is compatible. However, if the runtime environment uses Node.js 18, the application will fail to start.
Remediation:
Ensure deployment environments use Node.js 20 or higher. Verify that the Node.js version constraint in package.json (
^20) is enforced in all deployment pipelines.lodash (4.17.21 => 4.18.1)
Where your code is affected:
lib/actions/handlebars/populateTemplate.js:56- uses_.merge({}, payload, validationResult)Impact:
The
_.merge()function now blocksconstructorandprototypeas path keys. IfpayloadorvalidationResultobjects contain these keys, the merge operation will behave differently (leaving target untouched instead of merging).Remediation:
Review all data sources passed to
_.merge()in populateTemplate.js to ensure they don't rely on mergingconstructororprototypeproperties. Add validation to reject or sanitize such properties if they appear in user-controlled data.All breaking changes by upgrading tough-cookie from version 2.5.0 to 4.1.3 (CHANGELOG)
findCookies()- callback function must be last parameter.call()for inheritance with function prototypesAll breaking changes by upgrading handlebars from version 4.7.7 to 4.7.9 (CHANGELOG)
All breaking changes by upgrading lodash from version 4.17.21 to 4.18.1 (CHANGELOG)
_.unset/_.omitnow blockconstructorandprototypeas non-terminal path keys unconditionally. Calls that previously returnedtrueand deleted the property now returnfalseand leave the target untouched._.templatenow throws"Invalid imports option passed into _.template"whenimportskeys contain forbidden identifier characters, which were previously allowed.All breaking changes by upgrading body-parser from version 1.20.1 to 1.20.6 (CHANGELOG)
depthlevel for parsing URL-encoded data is now32(previously wasInfinity)limitvalues (e.g. unparseable strings orNaN) now throw instead of being silently ignored, which previously disabled size limit enforcementAll breaking changes by upgrading jws from version 3.2.2 to 3.2.3 (CHANGELOG)
All breaking changes by upgrading uuid from version 3.4.0 to 11.1.1 (CHANGELOG)
require('uuid/v4')is no longer supported.All breaking changes by upgrading brace-expansion from version 1.1.11 to 5.0.8 (CHANGELOG)
All breaking changes by upgrading express from version 4.18.2 to 4.22.2 (CHANGELOG)
depthlevel for parsing URL-encoded data is now32(previously wasInfinity)\,|, and^to align better with URL specAll breaking changes by upgrading js-yaml from version 4.1.0 to 4.3.0 (CHANGELOG)
All breaking changes by upgrading path-to-regexp from version 0.1.7 to 0.1.13 (CHANGELOG)
All breaking changes by upgrading cookie from version 0.5.0 to 0.7.2 (CHANGELOG)
✅ 53 CVEs resolved by this upgrade, including 4 critical 🚨 CVEs
This PR will resolve the following CVEs:
Handlebars.compile()allows attackers to inject arbitrary JavaScript through crafted AST objects, enabling Remote Code Execution when theNumberLiteralvalue field is emitted without sanitization.@partial-blockvariable with a malicious Handlebars AST through helpers, enabling remote code execution when the partial block is subsequently invoked.__lookupSetter__while blocking its symmetric counterparts, allowing prototype pollution when the non-defaultallowProtoMethodsByDefault: trueoption is set. This creates an inconsistent security boundary enabling potential code execution or object manipulation through template injection.resolvePartial()allows attackers to inject malicious strings intoObject.prototypethat are rendered as unescaped partial templates, enabling reflected or stored XSS attacks.lookup()function allows prototype pollution and property access bypass when the compat option is enabled, potentially leading to information disclosure or code execution. The security check vialookupProperty()is discarded, and an unguarded property access is performed instead.This issue affects form-data: < 2.5.4, 3.0.0 - 3.0.3, 4.0.0 - 4.0.3.
arrayLimitenforcement whencomma: trueis enabled, allowing attackers to create arbitrarily large arrays from a single parameter and cause denial-of-service through memory exhaustion.res.location()andres.redirect()methods when processing user-provided URLs.redirectfunction due to improper sanitization of user input.redirectfunction due to improper sanitization of user input.globalThis.__bundlerPathsOverridesaccess allows attackers to manipulate the prototype chain and alter application behavior..). For example,/:a-:b.*()and+()) generate regexps with catastrophic backtracking, causing severe ReDoS denial-of-service attacks with minimal input patterns triggering multi-second hangs.response.writeHead(), potentially leading to information disclosure or security bypass through header manipulation.$dataoption is enabled by using inherited property names likeconstructorortoStringas format values, causing unexpected validation behavior or errors.linkheaders, allowing attackers to cause denial of service through specially crafted requests.🔗 Related Tasks