Skip to content

feat(auth): add OIDC-backed Console sessions (AF-R09) - #127

Merged
KinguYume-G merged 8 commits into
mainfrom
feat/AF-R09-oidc-console-auth
Aug 18, 2026
Merged

KinguYume-G merged 8 commits into
mainfrom
feat/AF-R09-oidc-console-auth

Conversation

@KinguYume-G

@KinguYume-G KinguYume-G commented Aug 18, 2026 •

Copy link
Copy Markdown
Owner

Linked Issue

Closes #119 after Human Review and Human Merge.

Objective

Add provider-neutral OIDC Authorization Code + PKCE authentication to the Next.js Console, exchange the verified identity for a revocable AegisFlow session, and keep PostgreSQL membership plus fixed RBAC authoritative for every protected operation.

Non-Goals

  • No hosted IdP or production deployment.
  • No real GitHub write or hosted-model canary.
  • No OIDC group-to-role authorization.
  • No Redis-backed identity truth, automatic merge, or weakened policy boundary.
  • No production-ready claim while checks or review findings remain open.

Design Note

Changes

  • Added strict OIDC/JWKS verification and short-lived, hash-only opaque Console sessions.
  • Added additive PostgreSQL session persistence, migration, revocation, expiry, and audit paths.
  • Added server-only Next.js OIDC login/callback/logout/session routes with PKCE, state, nonce, encrypted transient cookies, and same-origin mutation guards.
  • Added database-authoritative tenant membership and fixed RBAC reconstruction for session requests.
  • Added a development/test-only, digest-pinned Keycloak Compose overlay and deterministic local identities.
  • Added unit/component/configuration tests and synchronized environment templates.
  • Reworked the repository README around the governed delivery loop, production target architecture, verified local scope, and explicit roadmap boundaries.
  • Hardened .gitignore and removed local generated caches/reports without touching business source files.

Architecture Impact

The browser holds only an HttpOnly opaque AegisFlow session token. Core stores only its SHA-256 digest and re-evaluates database membership and capabilities on each sensitive request. OIDC identifies the principal; it does not authorize tenant operations. Temporal, LangGraph, PostgreSQL, and Redis ownership boundaries are unchanged.

Security Impact

  • No security impact
  • Security review required
  • Tool permission changed
  • Tenant boundary changed
  • Secret handling changed

Credential material is excluded from prompts, traces, browser-visible state, committed configuration, and persisted raw values. Local HTTP/bootstrap exceptions are development/test-only and fail closed in production mode.

Tests

Local evidence on ebb5ca1:

  • .venv\\Scripts\\python.exe -m pytest -q -p no:cacheprovider --ignore=tests/runtime/temporal/test_workflow.py — 612 passed, 37 skipped.
  • Full backend invocation — 612 passed, 37 skipped, 5 failed because no Temporal service was listening on localhost:7233; no application assertion failed outside that service-dependent file.
  • npm.cmd --prefix web/console run test:run — 23 passed across 9 files.
  • npm.cmd --prefix web/console run typecheck — passed.
  • npm.cmd --prefix web/console run lint — passed.
  • npm.cmd --prefix web/console run build — passed; 13 dynamic App Router routes compiled.
  • Local MVP Compose configuration — passed.
  • OIDC/Keycloak Compose configuration — passed.
  • README relative-link/image validation — 9 local links valid, architecture image present, 0 mojibake markers.
  • git diff --check — passed.

GitHub evidence:

  • CI / test passed on the published head.
  • M5 k3s demo smoke / k3s-smoke is a required live check and must be green before merge; use the PR check result as the current source of truth.

Reliability

  • External session create/revoke paths are bounded and auditable.
  • Session revocation is monotonic and idempotent.
  • Existing local dry-run side-effect boundary is preserved.
  • Required k3s check passes.
  • All review findings are resolved and re-verified.

Documentation

  • README and architecture presentation updated.
  • Design Note and test plan added.
  • Environment examples contain placeholders only.
  • Current scope is separated from the production target.

Known Review Blockers

Four unresolved review threads remain:

  1. Propagate the OIDC overlay execution settings to the Temporal worker.
  2. Fail logout safely when Core session revocation fails.
  3. Evict rejected OIDC discovery promises so transient provider failures can recover.
  4. Reject backslash-based return paths to prevent an open redirect.

These findings are intentionally not marked resolved and no merge is requested until focused fixes and negative tests are reviewed.

Rollback

Disable the OIDC Console profile, stop the local Keycloak overlay, revoke active Console sessions, and restore the previous Console image. Downgrade the additive database migration only through the documented rollback process after session rows are expired or revoked.

Checklist

  • Linked to one Issue.
  • No real secrets committed.
  • README avoids unsupported production claims.
  • Local non-external backend and frontend checks pass.
  • Required GitHub checks pass.
  • Review conversations are resolved.
  • Human reviewer approves.
  • Human performs the merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f90a65223b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compose.oidc-dev.yaml Resolved
Comment thread web/console/src/lib/core-auth-client.ts Resolved
Comment thread web/console/src/lib/oidc-client.ts Resolved
@KinguYume-G KinguYume-G changed the title Feat/af r09 OIDC console auth feat(auth): add OIDC-backed Console sessions (AF-R09) Aug 18, 2026
@KinguYume-G
KinguYume-G marked this pull request as draft August 18, 2026 13:40
@KinguYume-G
KinguYume-G marked this pull request as ready for review August 18, 2026 14:24
@KinguYume-G

Copy link
Copy Markdown
Owner Author

ok

@KinguYume-G
KinguYume-G merged commit f077ed1 into main Aug 18, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d917534f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compose.oidc-dev.yaml Resolved
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.

[AF-R09] Add production OIDC sessions and server-side Console authorization

1 participant