Skip to content

Dashboard v0.10.0

Choose a tag to compare

@fadymondy fadymondy released this 09 Oct 00:05
· 1 commit to main since this release
04842f3

⚠️ Known limitations: read before upgrading

  1. Split-origin login regression.
    • The dashboard page guard reads the togo_session cookie from the request that reaches Next.js. The default same-origin /api rewrite provides that cookie.
    • With a cross-origin NEXT_PUBLIC_API_ORIGIN, the cookie is set on the API's origin only, so every visitor is sent to /login, even when DASHBOARD_REQUIRED_ROLE is unset.
    • Deployments that serve the API from a different origin than the web app should not upgrade until this is resolved. Same-origin deployments are unaffected.
  2. An administrator who is impersonating someone can still open the page shell.
    • Impersonation issues a bearer token only and never replaces the browser cookie, so the administrator's own session still opens the dashboard pages.
    • Data APIs authorize the impersonation bearer independently.

What's new

  • Opt-in DASHBOARD_REQUIRED_ROLE (API environment) restricts every page under web/app/(app) (including /profile) to accounts holding that role (#5, #6).
    • Unset or blank (the default): any signed-in account, as in v0.9.0.
    • Set (e.g. admin): role membership is checked against the database on every request.
      • API tokens (PATs) and impersonated sessions are refused even when the account holds the role.
      • The setting is read when the API boots, so changing it needs a restart.
  • GET /api/dashboard/access answers 204 when the caller is allowed, 401 when they need to sign in and 403 when they are forbidden. The response is always Cache-Control: no-store, private.
  • Server-side DashboardGate in the (app) layout and on every (app) page denies hard loads, RSC requests, prefetches and soft navigations.
    • The Next server forwards only togo_session, and only to the server-side API_ORIGIN.
    • Timeouts, unexpected answers and an invalid API_ORIGIN fail closed.

What it does not do

  • It is not the data boundary. Each API still enforces its own authorization. /api/_meta/*, /graphql and /events are not covered by this setting.
  • It does not hide the UI code. The compiled client bundles under /_next/static remain publicly downloadable. They expose UI, endpoint and field names, but no data.
  • Unsetting the variable is a security downgrade, not a rollback.

Requirements

  • togo-framework/auth v0.10.0, already pinned.
  • No migrations.

Verification

  • CI on the merged head: go and web both green. The web job runs the end-to-end page-guard suite.
  • End-to-end page-guard suite: every (app) route, requested as a hard load, an RSC request, a prefetch and a soft navigation, by anonymous, forged, PAT, impersonated, non-admin and admin callers, plus demotion, deletion and the unset role (395/395).
  • Gate-coverage test: fails if any (app) page renders outside DashboardGate.
  • Security review: an independent review found no bypass. All three of its findings were fixed before the merge.

Full diff: v0.9.0...v0.10.0