Menu ▾ ▴

#127 feat(oidc): verify assertions against trusted identity providers

closed
nobody
None
2026-10-26
2026-10-17
Anonymous
No

Originally created by: bosd

Summary

This adds the shared OIDC trust foundation that both the human SSO login in [#121] and the CI workload login in [#31] need. [#121] notes it "could share the issuer validation and trust-policy work needed for [#31]" — this is that layer, landed on its own so both features build on it instead of duplicating it.

The server gains a trust policy for external OIDC identity providers and a verifier that checks a signed assertion against it before any claim is trusted:

  • app/src/services/oidc.rs (new) verifies a token: the iss must exactly match a configured issuer, the signature must verify against that provider's published JWKS, the header algorithm must be one the issuer allows (asymmetric only), the aud must contain a configured audience, and exp (and nbf when present) must be current within a 60s skew. The JWKS URI is discovered from /.well-known/openid-configuration when not set explicitly, keys are cached (10 minute TTL) and refreshed once when an unknown key id appears. Rejections return a stable OidcError code and never echo token material.
  • server.toml accepts an [oidc] trust policy ([[oidc.issuers]] with issuer, audiences, optional algorithms and jwks_uri). Validation requires absolute URLs over HTTPS (HTTP only for a loopback host) and rejects symmetric algorithms.
  • AppState holds an Option<OidcVerifier> built at startup when providers are configured.

This PR intentionally ships no login or exchange endpoint: it is the verification core those features consume.

Refs [#31], [#121].

Compatibility

No compatibility impact. [oidc] is optional and defaults to no trusted providers, so existing configurations and behavior are unchanged. Adds one dependency, jsonwebtoken (MIT), which reuses the ring version already in the tree.

Verification

  • cargo test --manifest-path app/Cargo.toml --all-targets --all-features --no-fail-fast — all targets pass except three pre-existing commands::export::* tests that need script from util-linux (not installed here); they fail identically on main and are unrelated to this change.
  • New services::oidc tests cover acceptance, untrusted issuer, bad/absent audience, expiry, not-before, broken signature, symmetric algorithm, unknown key with refresh, key caching, rotation, discovery, and provider failure.
  • New config tests cover trusting issuers from server.toml, default algorithms, loopback HTTP, and rejection of remote HTTP, symmetric algorithms, and blank audiences.
  • cargo fmt --check and cargo check --all-targets --all-features pass.

Checklist

  • [x] I kept this pull request focused on one problem.
  • [x] I added or updated tests for behavior changes, or explained why tests are not needed.
  • [x] I updated the documentation and CHANGELOG.md when public behavior changed, or explained why they are not needed.
  • [x] I updated relevan documentation inside /docs

Related

Tickets: #121
Tickets: #128
Tickets: #31

Discussion

  • Anonymous

    Anonymous - 2026-10-26

    Ticket changed by: dopbase

    • status: open --> closed
     

Log in to post a comment.