fix(deps): update dependency fastify to v5.12.1 [security] - #570
Open
renovate[bot] wants to merge 1 commit into
Open
fix(deps): update dependency fastify to v5.12.1 [security]#570renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #570 +/- ##
=======================================
Coverage 46.21% 46.21%
=======================================
Files 70 70
Lines 1216 1216
Branches 75 75
=======================================
Hits 562 562
Misses 643 643
Partials 11 11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
renovate
Bot
force-pushed
the
renovate/npm-fastify-vulnerability
branch
2 times, most recently
from
April 27, 2026 21:36
638db37 to
55fc8dd
Compare
renovate
Bot
force-pushed
the
renovate/npm-fastify-vulnerability
branch
from
May 12, 2026 10:54
55fc8dd to
1438d8e
Compare
renovate
Bot
force-pushed
the
renovate/npm-fastify-vulnerability
branch
from
July 12, 2026 16:45
1438d8e to
fee8888
Compare
renovate
Bot
force-pushed
the
renovate/npm-fastify-vulnerability
branch
from
September 2, 2026 21:17
fee8888 to
0706df7
Compare
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:
5.8.4→5.12.1Fastify has a Body Schema Validation Bypass via Leading Space in Content-Type Header
CVE-2026-33806 / GHSA-247c-9743-5963
More information
Details
Summary
A validation bypass vulnerability exists in Fastify v5.x where request body validation schemas specified via
schema.body.contentcan be completely circumvented by prepending a single space character (\x20) to theContent-Typeheader. The body is still parsed correctly as JSON (or any other content type), but schema validation is entirely skipped.This is a regression introduced by commit
f3d2bcb(fix for CVE-2025-32442).Details
The vulnerability is a parser-validator differential between two independent code paths that process the raw
Content-Typeheader differently.Parser path (
lib/content-type.js, line ~67) appliestrimStart()before processing:Validator path (
lib/validation.js, line 272) splits on/[ ;]/before trimming:The
ContentTypeclass appliestrimStart()before processing, so the parser correctly identifiesapplication/jsonand parses the body. However,getEssenceMediaTypesplits on/[ ;]/before trimming, so the leading space becomes a split point, producing an empty string. The validator looks up a schema for content-type"", finds nothing, and skips validation entirely.Regression source: Commit
f3d2bcb(April 18, 2025) changed the split delimiter from';'to/[ ;]/to fix CVE-2025-32442. The old code (header.split(';', 1)[0].trim()) was not vulnerable to this vector because.trim()would correctly handle the leading space. The new regex-based split introduced the regression.PoC
Output:
Impact
Any Fastify application that relies on
schema.body.content(per-content-type body validation) to enforce data integrity or security constraints is affected. An attacker can bypass all body validation by adding a single space before the Content-Type value. The attack requires no authentication and has zero complexity — it is a single-character modification to an HTTP header.This vulnerability is distinct from all previously patched content-type bypasses:
Recommended fix — add
trimStart()before the split ingetEssenceMediaType:Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
fastify vulnerable to X-Forwarded-* spoofing under trustProxy hop-count
CVE-2026-16732 / GHSA-3m5p-2c4r-xxw2
More information
Details
Impact
The fix for CVE-2026-3635 (GHSA-444r-cwp2-x5xf) added a
proxyFn(socket.remoteAddress, 0)guard on theX-Forwarded-*reads inrequest.host,request.protocol,request.hostname,request.ip, andrequest.ips. That guard closes the IP, CIDR, and custom-function forms oftrustProxycorrectly because those forms compile to predicates that inspect the connecting address. The hop-count form (trustProxy: <number>) compiles to a predicate that structurally ignores the address argument, so the guard reduces to0 < tp, always true for anytp >= 1.Applications configured with
trustProxy: <number>(documented as "behind N reverse proxies",trustProxy: 1being the canonical single-proxy setting) remain vulnerable. An attacker who can reach the Fastify origin directly, bypassing the front-facing proxy, can spoof the request fields exactly as in the unpatched version. Impact class matches the parent CVE-2026-3635: host injection in generated URLs, HTTPS-enforcement bypass, secure-cookie / CSRF-origin bypass, host-based routing and cache poisoning.Patches
Patched in fastify 5.12.1. The numeric form of
trustProxyis now disabled at runtime and removed from the TypeScript type union.Workarounds
trustProxyvalue that validates the connecting address. Custom functions must inspect theaddressargument, not only the hop index.Severity
CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
fastify vulnerable to schema validation bypass via root primitive coercion mismatch
CVE-2026-18504 / GHSA-w2qp-rph6-63g4
More information
Details
Impact
fastifybefore 5.12.1, when a route uses a root-level primitive body schema (for example an integer with a minimum and maximum) and the default type coercion, validates the coerced value but exposes the original, uncoerced value to the route handler. For example, a JSON body"10"is coerced to the number10and passes an integer 1 to 10 schema, butrequest.bodystays the string"10". An application that trusts the validated type is handed a value that did not satisfy the schema, which can bypass limits the application enforces on that typed value. Object and array body schemas are not affected, they coerce their members in place.Patches
Upgrade to
fastify5.12.1.Workarounds
Until you can upgrade, avoid relying on the validated type of a root primitive body. Wrap the value in an object schema (object properties are coerced in place), for example accept
{ "value": 10 }and readrequest.body.value, or re-check the type in the handler.Severity
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
fastify/fastify (fastify)
v5.12.1Compare Source
What's Changed
Full Changelog: fastify/fastify@v5.12.0...v5.12.1
v5.12.0Compare Source
What's Changed
Reply.prototype.mediaTypeby @github-actions[bot] in #6946undefinedfor invalid media types by @github-actions[bot] in #6947Full Changelog: fastify/fastify@v5.11.3...v5.12.0
v5.11.3Compare Source
What's Changed
New Contributors
Full Changelog: fastify/fastify@v5.11.2...v5.11.3
v5.11.2Compare Source
v5.11.1Compare Source
What's Changed
New Contributors
Full Changelog: fastify/fastify@v5.11.0...v5.11.1
v5.11.0Compare Source
What's Changed
Content-Typeparameter values by @aquie00t in #6865New Contributors
Full Changelog: fastify/fastify@v5.10.0...v5.11.0
v5.10.0Compare Source
v5.9.0Compare Source
What's Changed
findwithsomeinhasKeyfor correct boolean semantics by @aquie00t in #6759AssertionErrorwithFST_ERR_PLUGIN_DEPENDENCY_NOT_REGISTEREDincheckDependenciesby @aquie00t in #6774New Contributors
Full Changelog: fastify/fastify@v5.8.5...v5.9.0
v5.8.5Compare Source
This fixes CVE CVE-2026-33806 GHSA-247c-9743-5963.
What's Changed
New Contributors
Full Changelog: fastify/fastify@v5.8.4...v5.8.5
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.