mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-10-25 22:10:25 +00:00
d2ee26cccd
BREAKING for anyone driving /api/v1/admin/* or admin account creation with a personal access token: those now answer 403 session_required. Use a `pad auth login` CLI session, or on self-host set PAD_ADMIN_API_TOKENS=allow. An admin's PAT carried full platform authority. codex reproduced the chain during BUG-3336's review: register an account with a chosen password, promote it to admin, sign in as it, and reset any account's password. A leaked admin token therefore escalated to interactive sessions for any account. - refuseAPITokenForAdmin guards the whole /api/v1/admin route group, so an admin route added later is refused by construction. TestBUG3361_EveryAdminRouteRefusesAnAdminPAT walks the router to hold it. - handleRegister refuses admin-create signup with an API token. - PAD_ADMIN_API_TOKENS=allow is the self-host escape hatch. It is read at startup, logs a WARN, and is never honoured in cloud mode. Documented in docs/deployment.md, Security. - A browser session and a CLI session (padsess_) are unaffected. So is the Pad Cloud sidecar, which authenticates with the cloud secret, never a PAT. /audit-log already refused a PAT (BUG-3334). Claude-Session: https://claude.ai/code/session_01H63zaWhkb5pAafx2WGjrVC