You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gw: harden admin auth defaults and unify ADMIN_API_TOKEN naming
Address review-style improvements lifted from PR #675:
- Fail-by-default. When `admin.enabled = true`, gateway now refuses to
start unless either an `admin_token` is configured (via `core.admin.admin_token`,
`DSTACK_GATEWAY_ADMIN_TOKEN`, or `ADMIN_API_TOKEN`) or `insecure_no_auth = true`
is set explicitly. Replaces the previous "empty token = open access + WARN"
policy. e2e configs opt into `insecure_no_auth = true`.
- Env-var fallback in Rust. `AdminAuthFairing::from_config` resolves the
token from config first, then `DSTACK_GATEWAY_ADMIN_TOKEN`, then
`ADMIN_API_TOKEN`. Operators running the binary directly no longer have
to template the TOML.
- SHA-256 in-memory storage. The plaintext token is hashed at startup;
only the 32-byte digest is retained. Verification SHA-256s the request
token and constant-time compares the digests via `subtle::ConstantTimeEq`.
- dstack-app deployment chain renamed `ADMIN_TOKEN` -> `ADMIN_API_TOKEN`
end-to-end (deploy-to-vmm.sh auto-generates it into .env, docker-compose
forwards it, entrypoint.sh injects it into `gateway.toml`,
bootstrap-cluster.sh requires it and sends `Authorization: Bearer`).
- Docs in `gateway/docs/cluster-deployment.md` now show the bearer-auth
pattern in every admin-curl example.
Tests: 4 new cases in `admin_auth::tests` cover the from_config policy
(insecure flag, config path, env fallbacks, error message). All 13
`admin_auth` tests pass; clippy with `-D clippy::expect_used
-D clippy::unwrap_used` is clean.
0 commit comments