Admin access and authentication
How console accounts are provisioned, how sign-in and sessions work, and the layers that protect the admin API.
The console is internal. There is no sign-up page, no registration endpoint, no self-service account creation and no default account.
Provisioning accounts
Operators manage accounts with the CLI, which reads passwords from stdin (hidden when typed in a terminal) and never from arguments or environment variables:
pnpm admin:user create --email ana@guildsman.com --role owner # --org Guildsman --project <slug>
pnpm admin:user reset-password --email ana@guildsman.com # recovery; signs out every session
pnpm admin:user disable --email ana@guildsman.com # deactivate and sign out
pnpm admin:user enable --email ana@guildsman.com
pnpm admin:user revoke-sessions --email ana@guildsman.com
pnpm admin:user listIn a deployed container: DATABASE_URL_DIRECT=… node dist/admin-users.js create --email … --role …. Every command writes an audit event (console_user.*, actor cli:<user>). Passwords must be at least 14 characters. Further roles are granted in Team & roles as before.
Sign-in and sessions
- Passwords are hashed with scrypt (N=2¹⁷, r=8, p=1, 16-byte salt); parameters are stored with each hash.
POST /v1/admin/auth/loginsets anHttpOnly,SameSite=Strictsession cookie (__Host-lynkoria_console,Secure, in production). Only the SHA-256 of the session token is stored.- Sessions expire after 30 idle minutes or 12 hours, and on logout, password reset or account disablement.
- Five consecutive wrong passwords lock the account for 15 minutes. Attempts are rate limited per client IP (
CONSOLE_LOGIN_RATE_LIMIT, 20/min) and per email (10/min). Unknown accounts take the same time to reject as wrong passwords. - Successful and failed sign-ins are audited with IP and user agent, never the password.
- Each user can list their own active sessions and end any of them from Account and sessions (audited as
console.session_revoked), and read their own sign-in history.
Layers
- Application authentication (required): the session above, checked on every
/v1/admin/*request. Service keys and messaging tokens are never accepted there. - Authorization: roles from
console_rolesper organization and project (owner,admin,developer,auditor), enforced server-side on every route. - Cross-site protection: mutations from any origin other than
CONSOLE_ORIGINare rejected; responses areno-store. - Network layer (optional, recommended): Cloudflare Access (
CF_ACCESS_TEAM_DOMAIN,CF_ACCESS_AUD) or a VPN. When Access is configured, every console request must also carry a valid Access assertion whose email matches the session. Access never replaces the session.
ADMIN_DEV_EMAIL bypasses sign-in for local development only and is rejected in production.
Audit log integrity
audit_events is append-only: database triggers (migration 0002) reject UPDATE, DELETE and TRUNCATE for every role, including the table owner, so neither a bug nor a compromised console session can rewrite history. Refused console changes are recorded as console.denied with the method and path; the entry is attached to a project only when the caller belongs to that project's organization, so outsiders cannot write into another organization's log (their refusals are kept unscoped). Console requests, refused or not, are limited to 600 per minute per user. See ADR 026.
Secrets in the console
Service keys and webhook secrets are shown once at creation or rotation and stored only as digests or derivations. Push provider credentials and scanner tokens live in deployment configuration and never appear in the console or its API. Key rotation and revocation are under API keys.
Verification
Integration tests cover sign-in with HttpOnly/SameSite cookies, logout, wrong passwords, unknown accounts, Access identity mismatch, lockout and recovery, disable/enable with forced sign-out, idle expiry, per-IP rate limiting, absent registration routes, RBAC denials and audit events.