Repository navigation
chore(deps): update dependency joi to v18.3.1 [security] (beta) - #1657
Merged
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## beta #1657 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 108 108
Lines 360 360
=========================================
Hits 360 360
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
This PR contains the following updates:
18.2.9→18.3.1joi: quadratic-time split in
string().email({ multiple: true })allows denial of serviceCVE-2026-118772 / GHSA-4528-x5fx-h6hg
More information
Details
Summary
Joi.string().email({ multiple: true })takes quadratic time to split a value that contains a long run of whitespace. One request with 100 KB of spaces blocks the Node.js event loop for several seconds, which causes a denial of service.Details
When the
multipleoption is set, theemailrule splits the value into addresses with a regular expression that removes whitespace on each side of the separator:String.prototype.splittries a match at each position of the value. At each position inside a whitespace run, the leading\s*reads the rest of the run, does not find a separator, and backtracks through all of it. A run ofnwhitespace characters without a separator therefore costsn²steps. This applies to the default separator and to all customseparatorvalues.The fix lets the leading whitespace match start only at the beginning of a whitespace run, so the split is linear:
The split results do not change. The regular expression is now built only when
multipleis set.Every
joirelease from17.1.1up to and including17.13.8, and from18.0.0up to and including18.3.0, is affected. Every@hapi/joirelease from16.0.0is affected.Workarounds for users who cannot upgrade:
.max()before.email(), for exampleJoi.string().max(1000).email({ multiple: true }). Themaxrule then rejects long values before theemailrule runs.abortEarly: falseoption with this schema. WithabortEarly: false, theemailrule runs even when themaxrule fails..trim()as a workaround. It removes only the whitespace at the start and at the end of the value.Proof of concept
Output on
joi@18.3.0(Node.js 26):Output on the patched version:
Over HTTP, send the whitespace in a field that the route validates with this schema:
Impact
This is a denial of service by CPU exhaustion. It affects each application that validates untrusted input with
Joi.string().email({ multiple: true })and that has no length limit before theemailrule. One request with 100 KB of whitespace blocks the Node.js event loop for several seconds, and the server cannot process other requests during that time. The attacker needs no authentication when the route is public, and a small number of concurrent requests can keep the service unavailable.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
hapijs/joi (joi)
v18.3.1Compare Source
v18.3.0Compare Source
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.