MVP-0.1 · Fail-closed configuration in production #254

Closed
opened 2026-09-20 20:16:01 +00:00 by sharang · 0 comments
Owner

Goal

With APP_ENV=production, the agent and the dashboard must refuse to start instead of silently degrading. Today authentication turns itself off when environment variables are missing, audience validation can be skipped, and several code paths fall back to a dev tenant. This is the first go-live blocker: everything else in MVP-0 assumes that a running production process is a correctly configured one.

What to change

  • Refuse to start in production when any of these is unset or empty: KEYCLOAK_URL / KEYCLOAK_REALM, KEYCLOAK_AUDIENCE, CORS_ALLOWED_ORIGINS, TENANT_REGISTRY_URL + its client credentials, PENTEST_ENCRYPTION_KEY, and a dashboard session key (config.rs:53-95).
  • Remove the validate_aud=false path outside dev (compliance-core/src/auth.rs:277-285, config.rs:53-95).
  • Add a timeout to the JWKS fetch (auth.rs:352).
  • No dev-tenant fallback in api/server.rs:283-292, platform.rs:40-43 or scheduler.rs:124-139. When the registry is configured, skip the scheduler tick instead of inventing a tenant.
  • The dashboard does the same for its 5 Keycloak vars (compliance-dashboard/src/infrastructure/keycloak_config.rs, auth_middleware.rs:24-27).

Acceptance

  • A test asserts startup fails with each production variable missing, one at a time, with a message naming the variable.
  • No build or runtime configuration can disable audience validation when APP_ENV=production.
  • The JWKS fetch cannot hang: it has an explicit timeout and a test covering the timeout path.
  • No request or scheduler tick can resolve to a dev tenant when the registry is configured.
  • The dashboard refuses to start with an incomplete Keycloak configuration.
  • cargo fmt --all --check and clippy with the exact CI flags pass.
## Goal With `APP_ENV=production`, the agent and the dashboard must refuse to start instead of silently degrading. Today authentication turns itself off when environment variables are missing, audience validation can be skipped, and several code paths fall back to a `dev` tenant. This is the first go-live blocker: everything else in MVP-0 assumes that a running production process is a correctly configured one. ## What to change - Refuse to start in production when any of these is unset or empty: `KEYCLOAK_URL` / `KEYCLOAK_REALM`, `KEYCLOAK_AUDIENCE`, `CORS_ALLOWED_ORIGINS`, `TENANT_REGISTRY_URL` + its client credentials, `PENTEST_ENCRYPTION_KEY`, and a dashboard session key (`config.rs:53-95`). - Remove the `validate_aud=false` path outside dev (`compliance-core/src/auth.rs:277-285`, `config.rs:53-95`). - Add a timeout to the JWKS fetch (`auth.rs:352`). - No `dev`-tenant fallback in `api/server.rs:283-292`, `platform.rs:40-43` or `scheduler.rs:124-139`. When the registry is configured, skip the scheduler tick instead of inventing a tenant. - The dashboard does the same for its 5 Keycloak vars (`compliance-dashboard/src/infrastructure/keycloak_config.rs`, `auth_middleware.rs:24-27`). ## Acceptance - [ ] A test asserts startup fails with each production variable missing, one at a time, with a message naming the variable. - [ ] No build or runtime configuration can disable audience validation when `APP_ENV=production`. - [ ] The JWKS fetch cannot hang: it has an explicit timeout and a test covering the timeout path. - [ ] No request or scheduler tick can resolve to a `dev` tenant when the registry is configured. - [ ] The dashboard refuses to start with an incomplete Keycloak configuration. - [ ] `cargo fmt --all --check` and clippy with the exact CI flags pass.
sharang added this to the Production MVP milestone 2026-09-20 20:16:01 +00:00
sharang added the criticalsecurity labels 2026-09-20 20:16:01 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#254