PYLON_ADMIN_TOKEN authenticates every privileged route:
/api/auth/sessionPOST in non-dev/api/auth/upgradein non-dev/api/admin/users/:id/export(GDPR export)/api/admin/users/:id/purge(GDPR delete)/api/sync/pushfrom admin contexts- Jobs / workflows / scheduler control planes
/studioin non-dev
Without downtime (two-token rotation)
The server only readsPYLON_ADMIN_TOKEN at startup. Rotation requires a restart. To do it without dropping traffic:
-
Prepare. Generate the new token:
-
Deploy side-by-side. Start a new instance with the new token, let the load balancer health-check promote it, then drain +
SIGTERMthe old one. The 30-second in-flight window covers admin calls that were mid-request. - Update clients. Any automation (CI, runbooks, cron, admin UIs) that hardcodes the old token must update. Grep for the old token prefix in Vault, 1Password, GitHub Actions secrets, Cloudflare environment, etc. before deleting the value.
- Verify + scrub. Hit one admin endpoint with the new token; if it works, delete the old one from your secret store.
Emergency (suspected compromise)
-
Generate a new token — skip no-downtime, it’s not worth the risk:
-
Revoke every active session and force re-login:
If you can’t reach the admin API with the old token, stop the service and clear the session DB:
- Rotate OAuth secrets too — same blast radius if the admin account was used to configure them.
-
Audit
audit_logfor the period the old token was valid. Theaudit_logplugin records who did what and when. -
File an incident report per
SECURITY.md.
On Pylon Cloud
Admin tokens are scoped per-workspace and managed via the dashboard. Rotation is a one-click operation with no downtime — Cloud handles the side-by-side restart for you. Old tokens stop working immediately on rotation.What NOT to do
- Don’t use the admin token as a session token. Admin is not “a user”, it’s a break-glass credential.
- Don’t commit the token to git, even in a test fixture. The pre-commit hook rejects 32+ hex strings in tracked files.
- Don’t pass it as a URL query parameter.
Authorization: Beareronly. URL params leak into proxy logs and browser history. - Don’t reuse the token across environments. Staging ≠ prod.
Rotation cadence
| Risk profile | Rotation frequency |
|---|---|
| Low-traffic side project | Yearly |
| Production user-facing app | Quarterly |
| Compliance-required (SOC2, HIPAA) | Per your control framework |
| Suspected compromise | Immediately (emergency path) |