Skip to content

feat(auth): add fail-closed OIDC provider configuration - #160

Draft
djwhitt wants to merge 11 commits into
oidc-static-authfrom
oidc-provider-config
Draft

feat(auth): add fail-closed OIDC provider configuration#160
djwhitt wants to merge 11 commits into
oidc-static-authfrom
oidc-provider-config

Conversation

@djwhitt

@djwhitt djwhitt commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate role-specific OIDC configuration before API/web listeners start
  • fetch discovery and JWKS through bounded Req calls with redirects disabled
  • supervise atomic provider metadata/key refreshes and fail closed on stale or unavailable material
  • map exact configured claim values into the closed capability contract
  • publish role runtimes only after the provider starts and withdraw them with the supervised subtree
  • exercise provider startup failure and endpoint-subtree restart through the real API and web supervisors

Tracker: T-231

Validation

  • ../bin/x mix ci
  • ../bin/test
  • ../bin/x mix dialyzer
  • repeated adversarial security review

Stack

Depends on #150. This is layer 3 of stack #151.

Stack managed with GitHub Stacks CLI.

Validate role-specific OIDC settings, fetch issuer-pinned discovery and public JWKS documents through bounded Req requests, and start an atomic supervised cache before API or web listeners. Static mode remains unchanged and OIDC requests remain denied until later authentication layers.

Includes T-231 configuration reference and adversarial coverage for redirects, response bounds, provider outages, key rotation, secret redaction, and exact claim-value capability mappings.
@djwhitt djwhitt changed the title oidc provider config feat(auth): add fail-closed OIDC provider configuration Aug 15, 2026
@djwhitt
djwhitt marked this pull request as draft August 16, 2026 00:09
Carry the updated lower stack and current origin/main into the published provider layer without rewriting existing commits.
T-231 validates that the fetched JWKS contains a usable signing key and moves network refreshes out of the provider GenServer. Failed refreshes are backoff-limited so unavailable providers cannot turn request traffic into serialized outbound retries.
T-231 removes the stale static-only release instruction and points operators to the mode-specific OIDC configuration and rollout guidance.
T-231 rejects duplicate key identifiers and explicit algorithm/key-type mismatches at startup, and terminates any in-flight refresh worker with its provider cache.
Require the browser callback to use the public web host and the fixed /auth/callback route, and add bounded configurable authorization scopes that always include openid. Reject mismatched deployments before the listener starts.

Tests: ../bin/x mix ci
Tests: ../bin/test
Tests: ../bin/x mix dialyzer

Refs T-231, T-234, and PL-27.
Keep an optionally configured browser client ID in API OIDC runtime configuration so the token layer can reject ID-token audiences instead of discarding the deployment boundary after validation.

Tests: ../bin/test test/smolquery/auth/oidc/config_test.exs

Refs T-231, T-232, and PL-27.
Inject the bounded provider HTTP client through role runtimes for deterministic supervision tests. Prove failed discovery prevents both listeners from starting and a provider crash restarts each endpoint subtree under rest_for_one.

Tests: ../bin/test test/smolquery_api/supervisor_test.exs test/smolquery_web/supervisor_test.exs

Refs T-231 and PL-27.
Publish API and web runtimes from a supervised child placed after the OIDC provider and withdraw them on shutdown. Failed provider startup can no longer leave a persistent runtime for a listener that never started.

Refs T-231 and PL-27.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant