Skip to content

Add Turnstile front-end auth flow for per-user job isolation - #3

Merged
Roy101 merged 1 commit into
mainfrom
turnstile-frontend-auth
Jul 28, 2026
Merged

Roy101 merged 1 commit into
mainfrom
turnstile-frontend-auth

Conversation

@Roy101

@Roy101 Roy101 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

When the server runs with MERGESE_REQUIRE_AUTH=1, the web UI now gates the app behind a Cloudflare Turnstile challenge (or an API key), exchanges it for a token via /api/v1/anon-token, and attaches that token to every request (Authorization: Bearer, or ?token= for the SSE log stream). Each visitor then sees only their own jobs; cross-tenant reads 404.

  • server: public /api/v1/config exposes require_auth + Turnstile site key; MERGESE_TURNSTILE_SITE_KEY env; _resolve_client accepts a ?token= query param so EventSource (which can't set headers) can authenticate the log stream.
  • frontend: auth gate overlay + Turnstile widget + token storage/refresh; api()/log fetch/SSE all carry the token; boot is deferred until auth resolves. Fully inert when the server has auth disabled.
  • docs: SECURITY.md + systemd unit note the new site-key var.

When the server runs with MERGESE_REQUIRE_AUTH=1, the web UI now gates the app
behind a Cloudflare Turnstile challenge (or an API key), exchanges it for a
token via /api/v1/anon-token, and attaches that token to every request
(Authorization: Bearer, or ?token= for the SSE log stream). Each visitor then
sees only their own jobs; cross-tenant reads 404.

- server: public /api/v1/config exposes require_auth + Turnstile site key;
  MERGESE_TURNSTILE_SITE_KEY env; _resolve_client accepts a ?token= query param
  so EventSource (which can't set headers) can authenticate the log stream.
- frontend: auth gate overlay + Turnstile widget + token storage/refresh;
  api()/log fetch/SSE all carry the token; boot is deferred until auth resolves.
  Fully inert when the server has auth disabled.
- docs: SECURITY.md + systemd unit note the new site-key var.
@Roy101
Roy101 merged commit d4d3e18 into main Jul 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant