The server is locked to 127.0.0.1 by default. Keep that binding when placing
Caddy or another HTTPS reverse proxy in front of it; do not expose port 8765
through the VM firewall.
For a public deployment, set PALETTE_PUBLIC=1 and provide
PALETTE_PASSWORD with at least 16 characters. The browser will use HTTP Basic
authentication. Store the environment file with mode 600, and never commit
it.
The application enforces:
- authentication in public mode;
- same-origin mutating requests and an optional generation rate limit;
- at most four active Stylix processes, each with a four-minute timeout;
- HTTPS and host allowlisting for remote wallpaper downloads;
- DNS-pinned public-HTTPS validation for user-supplied image URLs, including private, loopback, link-local, and reserved address blocking on every redirect;
- bounded API responses, image downloads, and image dimensions, with optional history count and disk-retention limits;
- JPEG, PNG, and WebP decoding and signature validation before processing;
- atomic metadata writes, strict record IDs, and non-symlink file serving;
- palette key/value validation;
- CSP, anti-framing, MIME-sniffing, referrer, and browser permission headers;
- a pinned Stylix revision;
- generic client errors while retaining detailed server-side logs.
Production checklist:
- Run as a dedicated unprivileged service account.
- Use a trusted Nix runtime. A normal system
nixcommand is used automatically; fornix-portable, install it outside/tmp, owned by that account and mode700, and setPALETTE_NIX_PORTABLE. - Put the application behind Caddy with automatic HTTPS.
- Allow inbound ports 80 and 443 only; keep 8765 private.
- Back up the configured palette data directory if the history matters.
- Enable VM security updates and log rotation.
- Rotate the password if it may have been exposed.
Example startup:
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
set -a
. ./.env
set +a
exec .venv/bin/python palette_server.pyUse a random password, for example:
openssl rand -base64 32Example Caddy configuration:
palette.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:8765 {
header_up X-Real-IP {remote_host}
}
}This substantially reduces the application-level attack surface, but it is not a substitute for patching the VM, protecting the cloud account, and monitoring resource usage.