From c3ded1f2aa7aae32c8e1856fdfae9ee4e308b16a Mon Sep 17 00:00:00 2001 From: g-but <41178744+g-but@users.noreply.github.com> Date: Tue, 19 May 2026 20:59:41 +0200 Subject: [PATCH] docs(env): document COCKPIT_ALLOW_LEGACY_DAEMON_TOKEN requirement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local daemon authenticates writes to cockpitapp.vercel.app (patch_project_state, /api/orchestration/runs//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/ 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) --- .env.example | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.env.example b/.env.example index 3e4c3afb3..40e8cff7e 100644 --- a/.env.example +++ b/.env.example @@ -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=