Repository navigation
v0.3.1 — Lease-based attach + control-plane bearer token
Lease-based connection tracking and control-plane bearer token. Additive patch -- no API breakage, full backward compat with v0.3.0.
Added
GET /daemon/attach-- lease-based connection tracking (ADR-003). The TCP connection IS the lease: when the client process dies (SIGKILL, OOM, closed terminal), the kernel closes the socket and the connection count drops. No heartbeats, no timers. Replaces counting-basedconnect/disconnectfor new clients- Bearer token on
/daemon/*endpoints --rand.Text()(crypto/rand) stored in PID file (0600).Authorization: Bearer <token>required for/daemon/attach,/daemon/connect,/daemon/disconnect,/daemon/shutdown./healthstays open. Constant-time comparison viacrypto/subtle Config.RequireToken-- whentrue, the bearer token is also required for the application handler (everything outside/healthand/daemon/). Defaultfalseforcurldebugging compatibility- Proxy attach with fallback -- proxy tries
GET /daemon/attachfirst; if daemon returns 404 (v0.3.0), falls back toPOST /daemon/connect+POST /daemon/disconnect. Token sent on all daemon requests when available - ADR-003 -- design document: why counting fails, lease via TCP, token via PID file, mixed-version matrix, alternatives rejected (heartbeats, SSE, mTLS)
- 12 new tests (3 integration), coverage 75.5% → 85%
Deprecated
POST /daemon/connectandPOST /daemon/disconnect-- useGET /daemon/attachinstead. Kept functional for backward compatibility with v0.3.0 proxies
Security
- DNS rebinding hardening completed:
loopbackGuard(v0.1.1) + bearer token (v0.3.1). A page with a rebinding domain that passes the Host check still cannot authenticate - Token never appears in
proxy.log, daemon stderr, or error messages
Mixed-version compatibility
| Proxy | Daemon | Behavior |
|---|---|---|
| v0.3.1 | v0.3.1 | Lease attach + bearer token (optimal) |
| v0.3.1 | v0.3.0 | Fallback to connect/disconnect, no token (compatible) |
| v0.3.0 | v0.3.1 | connect/disconnect with token from PID file (compatible) |
Full Changelog: v0.3.0...v0.3.1