Security & Authentication
Homepage includes optional password protection. It is fully GUI-driven — no environment variables are required to enable it.
First-run setup
When you open Homepage for the first time, a setup screen asks whether you want to enable password protection:
- Yes, add a password — enter and confirm a password of at least 12 characters. All future visits will require login.
- No, continue without — Homepage runs without any authentication. This can be enabled later.
Logging in
If password protection is enabled, you will see a login screen on every new session. Check Stay logged in to persist the session in localStorage (survives browser restarts). Leave it unchecked to use sessionStorage instead (cleared when the tab or browser is closed).
Sessions expire after 90 days of inactivity by default. An open, visible dashboard renews the session, as does returning to it before expiry. The session lifetime can be configured. A tab closed without Stay logged in still loses its session.
Managing authentication
Go to Settings → Security to:
| Action | Description |
|---|---|
| Enable password protection | Set up a password on an existing no-auth install |
| Change password | Requires your current password. Signs out every other device. |
| Sign out all devices | Ends every session, including this one |
| Disable password protection | Requires password confirmation; removes all auth requirements |
| Log out | Ends the current session |
How it works
- The password is stored as a bcrypt hash (cost 12) in the SQLite database — never in plain text.
- Auth material lives in a dedicated
authtable that no general-purpose API endpoint reads or writes. - A JWT secret is generated on first use and stored in the SQLite database, so it survives restarts when the data volume persists. You do not need to configure it.
- Requests authenticate with a Bearer token. The same token is also set as an
httpOnly,SameSite=Strictcookie, which is what authenticates the requests a browser makes on its own —<img src="/api/icons/…">and backup downloads, neither of which can set a request header. The cookie is accepted forGET/HEADonly, so it cannot be used to change anything. - Login and setup endpoints are rate limited to 10 attempts per 15 minutes per IP.
- Changing your password re-keys the server, so every previously issued token stops working immediately.
Widget credentials
Widgets talk to third-party services — Jellyfin, FreshRSS, Last.fm and so on — and need credentials for them. Unlike your dashboard password, these have to be replayed to the upstream service, so they are encrypted rather than hashed.
- Credentials are stored AES-256-GCM encrypted in a
widget_secretstable, separate from widget configuration. - They are never sent to the browser. The widget config API returns a placeholder for fields that have a stored value, so the settings form can show that a key is configured without being able to read it.
- When a widget refreshes, the browser sends only the widget's id. The server looks the credential up and adds it to the upstream request.
- Credentials are excluded from backup exports. Restoring a backup brings your layout back and asks you to re-enter keys.
- Stored credentials are bound to where they are sent: the service's URL, and the account for services you sign in to. Changing either means re-entering the credential, so a saved key cannot be pointed at another server. Fields that only choose what to show, such as a Last.fm user or a Plausible site ID, can be changed freely.
- Older Speedtest, NASA and Unsplash keys migrate into encrypted storage automatically. Old downloaded backups and browser caches on devices that have not loaded the update may still contain plaintext keys; delete those copies and rotate affected keys if they were shared.
The encryption key
By default the key is generated into your data directory as .encryption-key (mode 0600). That protects credentials in API responses, backups and git, but not against someone who can already read files on the host — the key sits next to the database it decrypts.
No .env file or manual key setup is required. Keep the data volume persistent and back it up securely. If you want to separate the key from the database, optionally mount a Docker secret at /run/secrets/homepage_secret_key (see docker-compose.yml) or supply a key file with HOMEPAGE_SECRET_KEY_FILE. Losing the key means re-entering every widget credential.
Exposing Homepage publicly
Enable password protection. Beyond that:
- Put it behind HTTPS. HSTS is sent in production builds, but only TLS at the proxy makes it mean anything.
- Protect the data volume and backups. The encryption key is generated automatically. Optionally use a separately mounted Docker secret to protect against a database-only leak; no
.envfile is needed. - Leave
CORS_ORIGINSempty unless you genuinely serve the frontend from a different origin. Empty means same-origin only. - Enable
TRUST_PROXY=trueonly behind a trusted reverse proxy. Direct installs ignore forwarding headers by default. The supplied Compose configuration explicitly opts in for proxied installs; set it tofalsefor direct access. Ensure untrusted clients cannot bypass the proxy and reach its trusted backend port. - Use the Docker socket proxy shipped in
docker-compose.ymlrather than mounting/var/run/docker.sockinto the app. Socket access is equivalent to root on the host, and mounting it:rodoes not restrict what the daemon will accept — the flag applies to the filesystem entry, not to the API.
No-auth installs on public URLs
If you chose no password at first-run setup and your instance is publicly reachable, any visitor could go to Settings → Security and enable a password themselves, locking you out. The no-auth mode is intended for use behind a firewall or VPN where you trust all visitors.
If your instance is on a public URL, always set a password.
Hardening notes
- Security headers (CSP, HSTS,
X-Frame-Options,X-Content-Type-Options,Referrer-Policy) are applied byhelmet. - Remote HTML — Mastodon posts, RSS article bodies — is sanitised with DOMPurify before rendering.
- Outbound HTTP and TCP probes allow LAN, Docker and loopback addresses, but reject metadata/link-local endpoints, alternate IP spellings, mapped IPv6 and blocked DNS answers at socket lookup time. A redirect is followed only back to the same server (the same address, or the same host over https) and only for reads; any other redirect is refused, so configure the address the service redirects to. URLs with a user name or password in them are refused: use the widget's credential fields. Environment HTTP proxies are not used, because they would resolve destinations outside this guard.
- Uploaded app icons are restricted to raster formats. SVG is rejected because it can carry script and is served from the app's own origin.