Skip to content

v1.0.0-alpha2: HTTPS overlay, hashed sync tokens and admin token UX

Pre-release
Pre-release

Choose a tag to compare

@mathys-lopinto mathys-lopinto released this 14 Apr 16:18
· 108 commits to master since this release
32fdd70

Tabby Sync Version 1.0.0 - Alpha 2

Second alpha. The backend now ships with an HTTPS overlay, hashed-at-rest sync tokens and a real admin UI for token management.

Highlights

HTTPS via Caddy. An optional docker-compose.https.yml overlay puts Caddy 2.11.2 in front of the app. By default it obtains a Let's Encrypt certificate over ACME (requires a public domain and port 80 reachable). For LAN, VPN or homelab setups, a single line in caddy/Caddyfile switches Caddy to a self-signed ECDSA P-256 certificate generated by scripts/generate-cert.sh. Only /api/*, /admin/* and /static/* are proxied to the backend; the rest is 404 at the proxy level. HTTP/3 is enabled.

Sync tokens hashed at rest. The config_sync_token cleartext column is gone. Users now hold a SHA-256 hash (config_sync_token_hash, indexed), and authentication is a hashed lookup that is effectively constant-time at the application layer. Tokens already in use are hashed in place by migration 0002, so connected Tabby desktops keep working without re-provisioning.

Admin UX for token management. Because the cleartext can no longer be read back from the database, the admin UI now owns the token lifecycle:

  • A Regenerate sync token button on the user edit page.
  • A dedicated display page at /admin/app/user/<pk>/sync-token-shown/ that shows the cleartext in a read-only field with a Copy button. The token is passed through the session and popped on render, so a reload falls back to a "no longer available" panel.
  • User creation also lands on that page, so staff cannot miss the token.

Tightened API surface.

  • ConfigSerializer.name regained the missing max_length=255 validator.
  • UserSerializer.active_config is scoped to the requesting user, closing a cross-user assignment hole.
  • active_version is now exposed through the API instead of being silently dropped.
  • PATCH is wired on /api/1/user, so clients no longer have to echo the whole object on a partial update.
  • DRF's SimpleRouter replaces DefaultRouter, dropping the discovery index that was rendered at /.

Middleware cleanup. TokenMiddleware no longer opens a Django session and monkey-patches it shut. It sets request.user directly, filters is_active explicitly for defense in depth and tolerates any whitespace between Bearer and the value.

Postgres volume fix. postgres:18-alpine hard-codes PGDATA=/var/lib/postgresql/18/docker. The compose mount was pointed at the old path, so the named volume was never actually written to and each restart looked like a fresh initdb. The mount now matches, data persists across restarts.

Test suite. 157 tests, 100% line coverage on tabby/. Coverage gated at 85% via pytest-cov in pyproject.toml.

Install

cp .env.example .env
# fill in DB_PASSWORD, DJANGO_SECRET_KEY, DOMAIN
docker compose up -d
docker compose exec tabby /app/manage.sh createsuperuser

Then http://localhost:9090/admin/, Users → Add user → Save. The admin redirects to the token display page; copy the token and paste it in Tabby desktop under Settings → Config sync.

For HTTPS with a self-signed certificate:

./scripts/generate-cert.sh
docker compose -f docker-compose.yml -f docker-compose.https.yml up -d

Upgrade notes

  • Run migrations (0002_hash_sync_token and 0003_alter_user_active_config_alter_user_active_version). Existing tokens are hashed in place; no client reconfiguration required.
  • The admin used to display the token as a plaintext field. It now shows nothing about the token; use the Regenerate sync token button to issue a new one if you need access to it.
  • GET /api/1/user still includes config_sync_token for backwards compatibility, but always returns null.

Caveats

  • Still alpha. The full stack (Postgres + Caddy HTTPS) has only been exercised on the author's machine.
  • No app-level rate limiting; put a real gateway in front for public deployments. The shipped Caddy overlay is meant for private / LAN / VPN contexts.
  • No tests (yet) for brute force / timing / concurrency; those remain theoretical concerns for a self-hosted backend behind auth.