HydraIssues

hydraissue admin: iamnim sign-in replaces the static admin token
done improvement Priority: high Project: hydraissue Reporter: 24 Oct 2026 15:30

Description

The admin web side of this tracker is gated by one static password, server.admin_token in config.yaml. Anybody who holds that string is an admin, the string is shared, and it names nobody. Standing rule #238 says every operator console must sit behind iamnim SSO, and that static console tokens are retired, not kept as a second door.

OWNER RULING: no break glass. The token login goes away completely. There is no fallback password and no bearer door into /admin.

WHAT CHANGES

  1. internal/iamnim/client.go: a client for the identity service with Me, Memberships and ErrUnauthorized. A fourth copy after hydramancer, hydraperforceprovision and hydraorganization, which is what #596 scoped. Extracting a shared package stays separate work.
  2. Sign-in routes, following hydraorganization (#596):
    • GET /login redirects to /login?redirect_uri=https://issues.experiencenet.com/authed
    • GET /authed reads ?token=, moves it into an HttpOnly Secure SameSite=Lax cookie, and redirects in one hop to /admin?signedin=1 so no credential stays in the address bar, in history or in a Referer header. Referrer-Policy: no-referrer and Cache-Control: no-store on that response. The query string is never logged.
    • POST /logout clears the cookie.
      The one-time code exchange is still not built upstream (#591), so ?token= scrubbed in one hop is what the identity service offers today.
  3. Authorization is membership of the Hydra organization, slug experiencenet. is_admin is NOT used: it names exactly one email per organization, so gating on it would admit cederik@hydrahardware.io and lock out cederik@cederik.com. A signed-in person without that membership gets a plain no-access page, not a redirect loop.
  4. server.admin_token is deleted from the config type, the example config and the docs. api_token is untouched: the identity service is the person edge and machines keep their bearer.
  5. Two loops that cost real time on #644 are closed here by design: a cookie the browser refuses, and a session the identity service rejects after it restarts. Both end on a page that says what happened, never a bounce back to sign-in.

ACCEPTANCE

  • GET /admin with no cookie redirects to /login, and /login redirects to the identity service with the right redirect_uri.
  • A member of experiencenet lands on /admin signed in. A signed-in non-member gets 403 and a readable page.
  • /authed carries Referrer-Policy: no-referrer and Cache-Control: no-store, and no session value appears in any URL after the hop.
  • No password form is served anywhere, and admin_token appears nowhere in the tree.
  • The public side, the report form and the API keep working exactly as before. Venue floor reports are untouched.
  • Runbook and testbooks updated.

ROLLBACK: hydraskin update hydraissue --tag --apply on pi-node-004-nvme.

Comments (1)

claude-code 24 Oct 2026 15:48

SHIPPED v1.19.0, live on the scale since 15:48 UTC.

VERIFIED ON THE LIVE SERVICE

  • GET /admin signed out: 303 to /login?next=%2Fadmin
  • GET /login: 303 to https://iamnim.com/login?redirect_uri=https%3A%2F%2Fissues.experiencenet.com%2Fauthed%3Fnext%3D... and iamnim serves that URL 200, so the return address is accepted
  • POST /login: 405. No password form is served anywhere
  • Public side untouched: /, /report and /issues/955 all 200 signed out, so a host on the stand reporting a fault is never sent to a sign-in
  • API bearer untouched: GET /api/v1/issues 200
  • The scale reaches the identity service: wget to https://iamnim.com/api/me from inside the container returns 401, which is the right answer with no session
  • Startup line on the node reads: Admin sign-in: https://iamnim.com, organization experiencenet

VERIFIED BEFORE THE RELEASE, locally and in tests

  • Full sign-in round trip against a stand-in identity service: /admin -> /login -> identity -> /authed -> /admin 200, cookie HttpOnly SameSite=Lax, no session value in any URL after the hop
  • A member of experiencenet gets the dashboard; somebody holding only visit-flanders gets 403 and a page saying so
  • A session the identity service forgot ends on a page, not a redirect, and the dead cookie is cleared
  • A browser that kept no cookie ends on a page that names the cause
  • A form post with no session gets 401 and a page saying the change was not applied
  • An unreachable identity service gives 502, never an open door
  • 11 tests in internal/api/handlers_auth_test.go cover all of it

STILL TO DO, and it needs a human: sign in once in a real browser as a member of experiencenet and walk the six live checks in docs/testbooks/admin-sign-in.md. A session cookie is a browser behaviour, and curl is not a browser.

ROLLBACK, if that sign-in does not work: hydraskin update hydraissue --tag v1.18.0 --apply on node-50ab5309 (pi-node-004-nvme). That reinstates the console password, since v1.18.0 predates this change.