Require an operator session for privileged dashboard access #258

Closed
opened 2026-08-08 03:31:22 +00:00 by timmy · 0 comments
Owner

Problem

The dashboard forwards a shared privileged Gitea token, but inbound dashboard routes have no authentication boundary. A network caller can read private work metadata and invoke issue, notification, review, and merge mutations as the configured Gitea user. CORS does not prevent direct requests.

Vertical slice

Add an optional single-operator access-token sign-in that exchanges the configured secret for a short-lived signed HttpOnly/Secure/SameSite session. Protect the dashboard and private APIs, validate same-origin mutation requests with a session-bound CSRF token, stop background delivery on session expiry, and provide sign-out/device-clear behavior. Keep health and sign-in assets public. Deployments exposed beyond an already-authenticated gateway must configure the secret.

Acceptance

  • Anonymous private requests return 401 before any Gitea call when access control is configured.
  • Valid sign-in sets a scoped secure HttpOnly session and returns a CSRF token without exposing the configured secret.
  • Foreign-origin or missing-CSRF mutations return 403 before any Gitea call.
  • Expired/logout sessions cannot use cached private APIs; logout tells the PWA to clear private local data and caches.
  • Public health remains available and readiness does not disclose the Gitea login in protected mode.
  • Existing and new behavioral tests pass.

Audit of all 254 historical issue/PR records and recent commits through #257 found no prior inbound dashboard session or CSRF boundary.

## Problem The dashboard forwards a shared privileged Gitea token, but inbound dashboard routes have no authentication boundary. A network caller can read private work metadata and invoke issue, notification, review, and merge mutations as the configured Gitea user. CORS does not prevent direct requests. ## Vertical slice Add an optional single-operator access-token sign-in that exchanges the configured secret for a short-lived signed HttpOnly/Secure/SameSite session. Protect the dashboard and private APIs, validate same-origin mutation requests with a session-bound CSRF token, stop background delivery on session expiry, and provide sign-out/device-clear behavior. Keep health and sign-in assets public. Deployments exposed beyond an already-authenticated gateway must configure the secret. ## Acceptance - Anonymous private requests return 401 before any Gitea call when access control is configured. - Valid sign-in sets a scoped secure HttpOnly session and returns a CSRF token without exposing the configured secret. - Foreign-origin or missing-CSRF mutations return 403 before any Gitea call. - Expired/logout sessions cannot use cached private APIs; logout tells the PWA to clear private local data and caches. - Public health remains available and readiness does not disclose the Gitea login in protected mode. - Existing and new behavioral tests pass. Audit of all 254 historical issue/PR records and recent commits through #257 found no prior inbound dashboard session or CSRF boundary.
timmy self-assigned this 2026-08-08 03:31:23 +00:00
timmy closed this issue 2026-08-08 03:42:54 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#258
No description provided.