Skip to content

Scoped API credentials (state, metrics, logs, system) for headless dashboard clients #4540

Backlog

Description

@pithead-architect

What's the problem

#3974's credential criterion: "This issue adds scoped credentials (state, metrics, logs, system) on top" of PR #3895's fixed per-route machine accounts. Nothing exists to build on yet: this base has no MACHINE_ROUTES table, no bearer scheme and no token store anywhere (verified by grep), and #3872/#3895 are still open. Today every API route rides the interactive login, so a headless script needs the same shared dashboard password, and there is no way to grant a client one scope, rotate it, or revoke it without the UI.

What it impacts

Headless operators scripting against /api/state, /metrics and /api/logs/* (and #3975/#3976 when they land); security posture of every external query API — #3974 requires unauthenticated requests rejected 401 and out-of-scope tokens 403, with credentials redacted in logs, API responses and describe-change output.

How I found it

Read #3974's Auth acceptance section, checked gh pr view 3895 (OPEN, base develop-v2.1.0), grepped the app and lib/pithead for MACHINE_ROUTES/bearer/token machinery (none on this base), and noted the log API's existing auth shape (Caddy X-Auth-User header, rate/follower gates in log_views) that scope checks must wrap.

How important is it

Medium-high as part of 2.1.0: it is the off-by-default security story for the external APIs (#3975/#3976/#3978 depend on #3974 for exactly this). Not startable before #3872/#3895 merge.

Acceptance criteria

  • Start gate: if MACHINE_ROUTES from Add dashboard login sessions with admin and viewer roles #3895 is not on the base, stop and return blocked on Dashboard login page with admin and read-only roles, replacing the browser's basic-auth prompt #3872.
  • Bearer tokens scoped to state, metrics, logs, system; every external API route answers 401 unauthenticated and 403 out-of-scope, pinned per route × scope; the interactive login session is not required for API clients.
  • CLI verbs create/rotate/revoke work with the UI off (api mode) and follow the repo's verb-registration requirements (completion and the ledger rows its docs/dev pages name); tokens never appear in logs, API responses, describe-change output or the support bundle — each redaction pinned.
  • External API routes are served on the LAN listener only: the onion vhost responds 404 for them (the log API's respond @logs 404 is the pinned precedent; the table that absorbs future routes must keep it).
  • The wizard/config-editor copy for dashboard.mode states what api mode means (the config editor already lists the key).
  • Tiers 1–2 unit/auth tests, then tier4-e2e targeted on a both-mode deploy showing 401/403 over the wire and a rotated token taking effect.

Possible solutions

Parent: #3974

Worker brief: Test tier: tiers 1–2 (pytest auth/route-table + CLI tests) plus tier4-e2e targeted on a both-mode deploy for the 401/403 proof.

HARD START GATE: this issue starts only after pithead#3872 / PR #3895 merge and their MACHINE_ROUTES table is on origin/develop-v2.1.0. First command: check for MACHINE_ROUTES on a fresh base (rg -nw MACHINE_ROUTES dashboard/). If absent, return blocked with blocked_on pithead#3872 and quote what you grepped. Do not invent a parallel machine-auth stack to work around #3895.

Scope: scoped bearer credentials (state, metrics, logs, system) layered on #3895's table; 401 unauthenticated / 403 out-of-scope on every external API route (logs now; system-info/metrics if merged); create/rotate/revoke CLI verbs (register per docs/dev verb-registration requirements); redaction pins (logs, API responses, describe-change, support bundle); onion containment 404 table extending the respond @logs 404 precedent; config-editor copy for what api mode means. Keep the interactive login path untouched; keep /metrics' existing auth behaviour for its current consumers unless #3895's merged table says otherwise. Tiers 1–3 green before the tier4 submit; quote bench-ci evidence unedited.

Activity

  1. added this to the v2.1.0 milestone on Nov 26, 2026
  2. added
    dashboard
    security
    needs-triage
    size:M
    on Nov 26, 2026
  3. pithead-architect commented on Nov 27, 2026

    @pithead-architect
    Author

    Release regroom (owner request, 2026-11-27): moved from v2.1.0 to v2.1.3. Headless-dashboard and system-info UI chain depends on the login work in 2.1.0; second UI chunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dashboardneeds-triagesecuritysize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions