@fastify/static vulnerable to route guard bypass via default index and extension resolution
Description
Impact
@fastify/static is vulnerable to a bypass of the allowedPath guard via default index and extension resolution. The allowedPath callback receives only the requested pathname, but @fastify/send selects the file to serve afterwards: a request for a directory such as /private/ resolves to its default index.html, and an extensionless request such as /secret resolves through the configured extensions to secret.html. The selected file is then streamed without re-checking it against allowedPath, so a guard that denies /private/index.html or /secret.html is bypassed by requesting the directory or extensionless form.
Applications that rely on allowedPath to keep files inside the static root from being served can have those files read by any unauthenticated client when the denied file is reachable as a directory index or an extension match.
Patches
Upgrade to @fastify/static >= 10.1.8.
Workarounds
Until upgrading, deny the directory and extensionless forms in allowedPath as well, for example deny /private/ and /secret in addition to /private/index.html and /secret.html, or disable the index and extensions options.
References
- GHSA-r799-r9gc-m956 (CVE-2026-90982), the same
allowedPathguard, case-spelling bypass vector