Skip to content

v0.1.36 — admin password + device pairing

Choose a tag to compare

@NebulaSleuth NebulaSleuth released this 26 Apr 23:12
· 226 commits to main since this release

Opt-in API security via per-device pairing.

Backend behavior: When ADMIN_PASSWORD_HASH is unset (default after upgrade), the backend behaves exactly as before — LAN clients keep working without changes. Once an admin password is set via /setup, every /api/* request requires X-Whatson-Auth except a small allowlist (health, login, pair start/poll, providers, update status).

Pair flow:

  1. Client POSTs /api/auth/pair/start, gets a 6-digit code
  2. Client shows 'Open /setup, log in, enter '
  3. Admin enters the code in /setup → server generates a 32-byte auth key, stores SHA-256 hash + device label in data/paired-devices.json
  4. Client polls /api/auth/pair/poll until it sees the key once, then stores it for X-Whatson-Auth

Admin UI: /setup now has a login screen, first-run admin-password setup, paired-devices list with revoke, and password change.

Implementation:

  • bcryptjs for password hashing
  • HMAC-signed cookies for admin sessions (no store, stateless)
  • Session secret auto-generated and persisted to .env on first run
  • Per-device auth keys stored only as SHA-256 hashes — paired-devices.json leaks don't expose keys

Roku and mobile pair flows ship in follow-up commits. Order of operations: upgrade backend now (no enforcement yet); pair clients once they ship; set admin password in /setup to flip enforcement on.