Repository navigation
feat(auth): add opt-in SAML federation through a trusted broker - #72
Conversation
SAML_ENABLED (off by default) adds broker-backed dashboard login. The gateway never parses SAML XML: an operator-run broker returns a compact JWS that is verified against pinned RS256 or Ed25519 keys and bound to the issuer, audience, recipient, nonce and browser state. Each request nonce is claimed once, and only an operator-created subject link maps a verified subject to an existing account, with no just-in-time accounts or administrator grants. Native ACS and metadata return 503 saml_native_unavailable. Request state, subject links and audit rows live in D1 (migration 0035).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
multillm-proxy | 0c9d36f | Oct 09 2026, 07:59 AM |
Summary
Adds opt-in SAML login through an operator-run SAML broker. The gateway never parses SAML XML. The broker validates the IdP response and returns a compact signed token, which the gateway verifies against pinned keys. With
SAML_ENABLEDunset oroff(the default), every/auth/saml/*and subject-link route returns 404 before any session, CSRF or storage work, and nothing else changes.SAML_ENABLED. Empty means off; a malformed value is off with one warning that leaves the value out.SAML_BROKER_URLis the HTTPS broker address.SAML_CALLBACK_URLpins the expected recipient independently of request headers.SAML_TRUST_CONFIG_JSONholds{issuer, audience, keys: [{kid, alg, public_key_pem}], max_age_seconds ≤ 300}.cryptographyonly):none, HMAC, unknown and mismatched algorithms are rejected.iat/exp(lifetime of at most 300 s, small fixed skew) and optionalnbfare checked.GET /auth/saml/loginstores digests of a random nonce and state, binds the state to the browser session, and redirects only to the configured broker./auth/saml/callbackverifies the token and claims the nonce exactly once; a replay returns 400saml_assertion_replayed.(issuer, subject)must match an operator-created link to an existing account; otherwise it returns 403saml_subject_unlinked.saml_session_unavailable./auth/saml/acsand/auth/saml/metadatareturn 503saml_native_unavailable. Native SAML needs a reviewed XML signature dependency, which is not installed.GET/PUT /admin/saml/linksandGET/PUT/DELETE /admin/saml/links/<id>need an administrator session and CSRF, and write audit rows. DELETE deactivates and keeps history.0035). Missing storage returns 503saml_storage_unavailableand never admits a login.Details are in
docs/saml-federation.md.Wiring
All new files; no existing file changes. The Worker forwards
/auth/saml/*to the Container unchanged, which a test confirms. The Wave 7 integration adds these:register_saml_federation_routes;samlstore endpoint and its dispatcher entry;Shared registrations
tests/test_saml_federation_worker.mjsintest:worker.worker/saml-identity.mjsin the edge module inventory, and the six SAML routes in the Flask route inventory.SAML_ENABLED,SAML_BROKER_URL,SAML_TRUST_CONFIG_JSONandSAML_CALLBACK_URLin the Container env keys.saml_requests,saml_subject_linksandsaml_auditinREQUIRED_D1_TABLES.Stacked on #71
Migration numbers must be contiguous in each PR, so this branch merges
feat/tenant-governance(#71, migration 0034), which stacks on #70 (0033). Merge those first. SCIM provisioning stacks on this one.Tests
tests/test_saml_federation.pyandtests/test_saml_federation_worker.mjscover:npm run test:worker: 1,821 passed.npm run test:integration: 7 passed.cf:migrations:checkreports 35 contiguous, additive migrations.test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.tests/test_frontend_build.mjsfails locally because@tailwindcss/cliis not installed. It fails the same way on main.Apply the migration before enabling the flag:
npx wrangler d1 migrations apply multillm-intelligence --remote.CI notes
python/nodejobs: the dependency-audit steps fail on every branch, including main. fix(deps): clear the CI dependency audit advisories #42 fixes that.AdmissionCoordinatorDurable Object migration, whichwrangler versions uploadcannot apply. This is expected untilwrangler deployruns on main.This is part of Wave 7. The README line comes with the Wave 7 integration PR.