Hardens outbound host validation against SSRF

- resolves host names and validates every address, with a connect callback that pins the checked address

- applies the guard to every outbound HTTP client, with distinct rejection and resolution failures and warning logs

- scopes the MusicBrainz private base URL permission to the configured host and blocks link local and cloud metadata endpoints

- keeps provider redirects bounded and strips credentials and hop-by-hop headers on cross-origin redirects

- adds unit, security, and end-to-end coverage, and updates the manual
This commit is contained in:
BinaryAlley committed 2026-11-18 10:51:41 +02:00
1 parent ecdb39cc6a
commit 24af00579c
28 files changed
+2977 -162

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ You are handing Lumina the keys to your files, so it is built to deserve that tr
- **Locked down by default.** The API authenticates every request, and only endpoints explicitly marked as public can be reached without signing in. Accounts, roles, fine grained permissions and policies decide who may reach which library or content, and sensitive endpoints are rate limited per client IP.
- **Secrets stay secret.** A production deployment must supply its own signing and encryption keys, and the server refuses to start without them.
- **Themes and plugins are treated as untrusted.** Theme packs are validated, their template and asset paths are normalized and confined to the pack, and their archive size, expanded size and entry count are capped. A plugin archive has its directory components stripped, so it cannot write outside the plugin directory, but it has no size or entry limit. Templates render through a small engine that cannot execute code, and a broken theme falls back to the built-in rendering. Themes can still ship their own JavaScript, so only install code from sources you trust.
- **Nothing phones home.** Lumina itself makes no outbound connections on its own. It reaches the internet only when your configuration tells it to, for example when you enable a metadata provider. Part of what it fetches on your behalf is guarded: artwork downloads reject literal loopback, private, link local and carrier grade NAT addresses, and follow redirects only to public HTTPS hosts. That guard is not a hard boundary, though. It does not resolve host names, so a name that points at an internal address can still get through, and the metadata calls a provider makes go out through the provider's own client, without that guard at all. Some providers add a check of their own: the MusicBrainz provider refuses a base address that is not public unless you turn on its `Allow LAN/Private Base URL` setting, which exists for pointing it at a self hosted instance. Enabling a web provider is trusting it to make requests from your server. Everything the client loads, from stylesheets and scripts to images, fonts and icons, is served from your own server, so using the client pings no third party that could note where you are or what you are looking at. One exception ships switched on, and it is worth knowing about: a book can carry its own styles, and those styles can make the browser load resources from outside servers, which those servers could observe. Lumina keeps a book's styles by default because it looks better, so a book from an untrusted source can leak your location this way. The `Preserve book styles` setting (see [Managing Libraries](managing-libraries/index.md)) turns it off, stripping the styles and closing that door, at the cost of the book's original look.
- **Nothing phones home.** Lumina itself makes no outbound connections on its own. It reaches the internet only when your configuration tells it to, for example when you enable a metadata provider. Everything it fetches on your behalf is guarded: before any provider request leaves the server, the host name is resolved, and the request is refused when any address it resolves to is loopback, private, link local, carrier grade NAT or otherwise internal. Provider requests are made directly, never through an outbound HTTP proxy, so the connection is made to the very address that was checked, and a name that changes its answer between the check and the connection cannot slip through. The same guard covers the metadata and artwork calls of the providers, and redirects are followed only to public HTTPS hosts, checking every hop. The single exception is one you opt into, and it covers every request the MusicBrainz provider sends to the base address you configure, including redirects that stay on that host and that may use plain HTTP when the base address itself does: the provider accepts a base address that is not public only when you turn on its `Allow LAN/Private Base URL` setting, which exists for pointing it at a self hosted instance. It does not extend to any other host, and the link local and cloud metadata ranges stay blocked even then. Enabling a web provider is still trusting it to make requests from your server. Everything the client loads, from stylesheets and scripts to images, fonts and icons, is served from your own server, so using the client pings no third party that could note where you are or what you are looking at. One exception ships switched on, and it is worth knowing about: a book can carry its own styles, and those styles can make the browser load resources from outside servers, which those servers could observe. Lumina keeps a book's styles by default because it looks better, so a book from an untrusted source can leak your location this way. The `Preserve book styles` setting (see [Managing Libraries](managing-libraries/index.md)) turns it off, stripping the styles and closing that door, at the cost of the book's original look.
- **It is tested, a lot.** Do not take any of this on faith. The project is covered by more than 10,000 tests, including a dedicated security suite, because Lumina puts stability and security ahead of moving fast.
## Documentation, diagrams and comments