@fastify/static vulnerable to information disclosure of denied dotfiles via directory listing
Description
Impact
When @fastify/static is configured with dotfiles: 'deny' (or 'ignore') together with directory listing (list) enabled, a request for a denied dot-directory such as /.git/ returns its directory listing instead of being refused. @fastify/send answers the request with a 403, but the listing fallback misreads that 403 on a path ending in / as a directory without an index file and serves the listing. An unauthenticated client can enumerate the names of files and subdirectories, recursively, inside dot-directories the operator explicitly denied (for example .git structure, backup and key file names). File contents remain protected (403); only names are disclosed. This contradicts the documented behavior that dotfiles are excluded from listings when dotfiles is deny or ignore.
Patches
Fixed in @fastify/static 10.1.12. The directory-listing fallback no longer serves a path that dotfiles: 'deny' or 'ignore' denies.
Workarounds
Disable directory listing (list), or do not serve a root that contains dot-directories. Requests for individual dotfiles were already refused with 403 and are unaffected.