Files
pruefwerk/compliance-core
Sharang ParnerkarandClaude Opus 5 806d0ad004
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Failing after 4m25s
feat(platform): fail closed when auth configuration is missing (#254)
The scanner degraded quietly when auth configuration was absent: no Keycloak
meant no JWT check and a synthetic `dev` tenant for every request, an unset
CORS_ALLOWED_ORIGINS meant permissive CORS, no registry meant entitlements
were never checked, and a registry outage sent the scheduler at `<prefix>_dev`
with no ladder filter. Convenient on a laptop, unacceptable anywhere with
customer data.

`APP_ENV` (dev | staging | production) now decides. Everything but `dev` is
hardened:

- `AgentConfig::validate_deployment` runs at load and lists *every* missing
  setting at once (KEYCLOAK_URL/REALM/AUDIENCE, CORS_ALLOWED_ORIGINS,
  TENANT_REGISTRY_URL + client id/secret, PLATFORM_ALLOWED_CLIENTS), so one
  corrected deploy is enough.
- The dev-tenant injector, the permissive-CORS fallback, the skip-entitlement
  path and the open platform endpoints are all unreachable when hardened —
  each keeps a second check that denies rather than widens access.
- The built-in PLATFORM_ALLOWED_CLIENTS defaults apply in dev only, so a prod
  agent never accepts a staging service token.
- The scheduler treats the registry as authoritative: an empty list or a failed
  call skips the tick.
- The dashboard refuses to start hardened without its five Keycloak variables
  (a partial config silently served every page), and the MCP server refuses
  stdio, whose synthetic tenant has no bearer check.
- The JWKS fetch gets a 5 s timeout; it holds the cache write lock, so an
  unreachable Keycloak used to queue every authenticated request behind it.

`AgentConfig` gains a `Default` impl with the loader's dev defaults, which the
two test constructors now use instead of listing 45 fields.

First issue of the MVP-0 safety baseline; part of #253.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-09-20 22:30:00 +02:00
..