Security model¶
HomeVault is designed for a single household on a trusted network.
- Login is optional and off by default. While it is off, anyone who can reach the port can view, change and delete everything, download or restore backups, and create API keys.
- API keys protect
/api/external, which always requires one. A key's scope (read or write) limits it; user roles do not apply to keys. - Other websites cannot read the API, and changing requests they make your browser send are refused, also while login is off.
- The NAS password and S3 secret key are encrypted in the database, never returned by the API and never included in backups. API keys are stored only as hashes.
Recommended deployments:
| Scenario | Do this |
|---|---|
| Home LAN only | Turn on a login unless everyone on the network may change everything. Don't port-forward 5959 on your router. |
| Access from outside | Use a VPN (WireGuard, Tailscale, ZeroTier), or an authenticating reverse proxy (Authelia, Authentik, Cloudflare Access, or basic auth in Nginx Proxy Manager/Caddy/Traefik) with HTTPS. |
| Integrations from outside | Same as above, but let /api/external/ through without the proxy login; HomeVault requires an API key there. |
| Shared or untrusted network | Put it behind an authenticating proxy, even internally. |
Login, users and roles¶
Turn it on under Settings → Security. That creates the first admin, who can add more users there.
| Role | Can |
|---|---|
| Admin | Everything, including users, backups, API keys, Master Data and test data. |
| Editor | Add, change and delete entries and files. Change floors and rooms, but not add or delete them (that includes turning a box into a room, and restoring a deleted room). |
| Viewer | Look, search, download documents and export CSV. Nothing that changes data. |
The server enforces the roles, for the web app and offline sync alike.
- Passwords are stored as bcrypt hashes. Sessions last 30 days in an
HttpOnly,SameSite=Laxcookie, markedSecurebehind HTTPS. - Changing requests must come from HomeVault's own pages, and repeated failed sign-ins are slowed down.
- Accounts are kept in
config/auth.jsonin the data folder, outside the database, so restoring a backup does not change who can sign in. Backups do not include it. - Locked out? Delete
config/auth.jsonand restart: login is off again and every account is gone. A damaged file keeps everyone out rather than opening the app. - Use HTTPS if HomeVault is reached from outside your network, or the password travels in the clear.
- A browser that has signed in keeps an offline copy of the inventory. Signing out clears it.
Built-in hardening: downloading images from URLs blocks private, loopback,
link-local and carrier-grade NAT addresses (SSRF protection, re-checked at
connect time); file uploads are checked by their content and WebP uploads are
decoded by Go code; only pictures are served from the data folder; attached
documents are only ever sent as downloads; file paths are confined to the data
directories; request sizes are limited; the database editor uses a table
allow-list; and the web app sends a content security policy,
X-Frame-Options: DENY, nosniff and a strict referrer policy. The container
contains no TLS keys or secrets.
Update checks¶
HomeVault asks GitHub whether a newer release exists, about 30 seconds after start and then once a day. It is on by default.
- The request goes from the server to
api.github.com/repos/jnanadarshan/homevault/releases/latest. It carries no inventory data, version or identifier, but GitHub sees your IP address. - Nothing is downloaded or installed. An admin sees a notice and updates with Docker as usual.
- Turn it off under Settings → General → About, or set
UPDATE_CHECK=falseso that no request is ever made, including the first one.
Container privileges¶
| Process | Runs as | Can reach |
|---|---|---|
Supervisor (entrypoint.sh) |
root, with the few capabilities in docker-compose.yml |
waits for the others |
| Web app (the only network listener) | an unprivileged user without capabilities | cannot read the data folder |
API (listens on 127.0.0.1 only) |
PUID:PGID, without capabilities |
the data folder |
| Mount helper (only with NAS mounting) | root with SYS_ADMIN |
see below |
The root file system is read-only, no program has a setuid bit, and
no-new-privileges is set. The data folder is handed to PUID:PGID at start.
Setting user: in Compose also works: everything then runs as that user.
NAS mounting¶
Prefer mounting the share on the host and using the Local type: the
container then needs no mount rights. A Local destination must be inside
/mnt, /media, /backups, /nas, the backup folder, or a directory listed
in BACKUP_TARGET_ROOTS.
With docker-compose.nas.yml, mounting is done by a separate root process that
the API can ask for exactly two things: test a share, or copy a backup archive
to it. It checks every request itself:
- the host must be a plain name or address, never this machine or a link-local address; share paths cannot add mount options;
- mounts are always
nosuid,nodev,noexec, at a place the helper chooses, and removed after each copy; - the SMB password is passed in a root-only file, not on the command line;
- only files named like HomeVault backups are copied, and symbolic links are not followed;
- setting up a mount needs a signed-in admin (override:
NAS_MOUNT_WITHOUT_LOGIN=true), and API keys cannot trigger a copy.
SYS_ADMIN and an unconfined AppArmor profile still weaken the container: a
flaw in the kernel or in the helper would matter more than without them.
Do not use privileged: true, which gives the container the host's devices.
A restored backup never changes where this server sends its backups.
Stored secrets¶
The NAS password and S3 secret key are encrypted with AES-256-GCM. Values saved by earlier versions are converted at the first start, and the database is rewritten so the old text does not linger in it.
The key is created in config/secret.key in the data folder, readable only by
the API's user. What this protects depends on where the key is:
| Someone obtains | Key in the data folder (default) | Key elsewhere (SECRET_KEY_FILE) |
|---|---|---|
| The database file alone | Secrets protected | Secrets protected |
| A copy of the whole data folder | Secrets readable | Secrets protected |
| Control of the running container | Secrets readable | Secrets readable |
To keep the key outside the data folder, create it once and mount it read-only.
The file must be readable by PUID:
openssl rand -base64 32 > homevault.key
sudo chown 1000:1000 homevault.key && sudo chmod 400 homevault.key
volumes:
- ./homevault.key:/etc/homevault/secret.key:ro
environment:
- SECRET_KEY_FILE=/etc/homevault/secret.key
- Keep a copy of the key if you copy the database by hand. Without it, enter the NAS password and S3 secret again. Restoring a HomeVault backup is not affected: backups carry no secrets, and this server keeps its own.
- Changing the key (for example by setting
SECRET_KEY_FILElater) makes saved secrets unreadable; enter them again. - A missing
SECRET_KEY_FILE, or a damaged key file, stops HomeVault at start instead of continuing without protection. - Copies of the data folder made before the upgrade still hold the old clear text. Change those passwords if such copies may have been exposed.
- Login accounts and API keys are unaffected: they are stored as hashes.
Behind a reverse proxy¶
- Set
TRUST_PROXY=trueso rate limits use the client address the proxy reports. Leave itfalseif clients can reach port 5959 directly. ALLOWED_HOSTS(comma separated) refuses other host names, which stops DNS rebinding while login is off.
Found a vulnerability? Please report it privately through GitHub Security Advisories rather than in a public issue.