Skip to content

feat: add optional OIDC bearer authentication - #149

Merged
maralbahari merged 13 commits into
mainfrom
codex/issue-102-oidc-auth
Aug 3, 2026
Merged

feat: add optional OIDC bearer authentication#149
maralbahari merged 13 commits into
mainfrom
codex/issue-102-oidc-auth

Conversation

@franciscojavierarceo

@franciscojavierarceo franciscojavierarceo commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add opt-in OIDC bearer authentication for every defined /v1/* HTTP and WebSocket route while keeping /health and /ready public
  • validate asymmetric JWTs through secure discovery and bounded, cached, single-flight JWKS refreshes; preserve protocol-specific OpenAI, Anthropic, and Responses WebSocket error contracts
  • enforce OIDC_AUDIENCE as the complete audience trust set and validate every presented azp
  • consume identity credentials at the gateway boundary, keep OpenAI upstream credentials operator-owned, and preserve explicit Anthropic upstream x-api-key pass-through
  • retain token expiration for long-lived WebSocket sessions and emit the canonical Responses error event after expiry
  • document server configuration plus Codex and Claude Code client setup
  • document a tested GitHub OAuth -> Dex OIDC -> agentic-api deployment flow, including PKCE login and production guidance

This is the first focused slice of #104 under the #102 authentication umbrella. Tenant and persisted-state ownership remain intentionally tracked by #107.

Refs #102
Refs #104

Test Plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test
  • uvx pre-commit run --all-files
  • uv run --with-requirements docs/requirements.txt mkdocs build
  • live local GitHub OAuth login through Dex v2.45.1 using authorization code with PKCE
  • unauthenticated and authenticated /v1/models checks, plus authenticated /v1/responses/compact
  • upstream credential-separation check proving the OIDC ID token was not forwarded
  • regression coverage for strict audience/azp validation, cancellation-safe and bounded JWKS refreshes, Anthropic request IDs, OpenAI/Anthropic upstream credential policy, and post-upgrade WebSocket expiry
  • read-only Claude review: no actionable findings
  • gstack testing, maintainability, security, performance, migration, and red-team passes; all actionable findings fixed and final reruns clean

The optional gstack Codex export was not run because the local approval policy blocked sending the repository diff to an external service.

@franciscojavierarceo
franciscojavierarceo marked this pull request as ready for review July 29, 2026 09:05
@franciscojavierarceo
franciscojavierarceo marked this pull request as draft July 30, 2026 14:30
@franciscojavierarceo
franciscojavierarceo force-pushed the codex/issue-102-oidc-auth branch from 1c29583 to dc3b252 Compare July 31, 2026 09:40
@franciscojavierarceo
franciscojavierarceo marked this pull request as ready for review July 31, 2026 09:45

@maralbahari maralbahari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. left some inline comments

Comment thread crates/agentic-server/src/handler/websocket/responses.rs Outdated
Comment thread crates/agentic-server/src/auth.rs Outdated
Comment thread crates/agentic-server/src/auth.rs Outdated
Comment thread crates/agentic-server/src/auth.rs
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
@franciscojavierarceo
franciscojavierarceo force-pushed the codex/issue-102-oidc-auth branch from da1f24f to c25567f Compare August 3, 2026 15:02
@maralbahari
maralbahari merged commit 4dafac2 into main Aug 3, 2026
5 checks passed
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.

2 participants