docs(env): document COCKPIT_ALLOW_LEGACY_DAEMON_TOKEN requirement

The local daemon authenticates writes to cockpitapp.vercel.app
(patch_project_state, /api/orchestration/runs/<id>/finish, etc.) via the
COCKPIT_DAEMON_TOKEN bearer. src/lib/session.ts:getApiUserId only honors
that token when COCKPIT_ALLOW_LEGACY_DAEMON_TOKEN=1 is also set on the
server — a safety gate to prevent accidental multi-tenant misuse.

Verified by curl: PATCH /api/project-states/<tab> returns 401 without
the flag, even with a valid token. With the flag, the daemon-side loop
(state push + outcome finish) closes against the cloud deployment.

Companion change: set COCKPIT_ALLOW_LEGACY_DAEMON_TOKEN=1 on Vercel
production (via vercel env add, no commit).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Opus 4.7 committed 2026-05-19 20:59:41 +02:00
1 parent a003696e7c
commit c3ded1f2aa
1 file changed
+13
+13
View File
@@ -19,3 +19,16 @@ COCKPIT_DEFAULT_TIMEZONE=Europe/Zurich
# Docker only — Postgres password (must match DATABASE_URL above)
POSTGRES_PASSWORD=changeme
# ── Daemon ⇄ Cloud bridge ────────────────────────────────────────────────────
# When the local daemon talks to a remote Cockpit (e.g. cockpitapp.vercel.app)
# it authenticates with a bearer token. Two paths exist:
#
# 1. Mint a per-user ck_* token from /settings (preferred, multi-tenant safe).
# 2. Use COCKPIT_DAEMON_TOKEN as a shared bearer — single-tenant only.
#
# To enable path (2), set BOTH of these on the *server* (Vercel / wherever
# Cockpit is hosted). The flag is required because the token maps to the
# "default" user and must not be on by accident in multi-tenant deployments.
COCKPIT_DAEMON_TOKEN=
COCKPIT_ALLOW_LEGACY_DAEMON_TOKEN=