Skip to content

feat(auth): verify OIDC with test IdP - #178

Merged
moncher-dev merged 5 commits into
mainfrom
feat/168-oidc-idp-stack
Aug 21, 2026
Merged

feat(auth): verify OIDC with test IdP#178
moncher-dev merged 5 commits into
mainfrom
feat/168-oidc-idp-stack

Conversation

@moncher-dev

@moncher-dev moncher-dev commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

  • Dex 기반 mock OIDC provider를 docker-compose.test.yml에 추가하고, npm run e2e가 authorization-code 로그인 플로우를 cold stack에서 검증하도록 연결했습니다.
  • QA 범위는 첫 로그인 자동 프로비저닝, 두 번째 로그인 동일 users row 재사용, Dex group claim 기반 admin 매핑, allowlist 거부, AUTH_LOCAL_ENABLED=false password 차단, API-key bundle upload 비회귀까지 포함합니다.
  • AC-04는 .evidence/20260821-0216-feat-168-oidc-idp-stack-attempt1/ 증거 번들로 Verified 처리했고, Authentik 2026.8.0 기준 수동 sign-off 절차를 README에 문서화했습니다.

변경 지점 다이어그램

Docker test stack
  docker-compose.test.yml
    -> oidc: dexidp/dex:v2.44.0
    -> tests/oidc/dex-config.yaml

E2E runner
  npm run e2e
    -> web Playwright auth-bypass suite
    -> web Playwright OIDC suite
       -> API AUTH_BYPASS=false / AUTH_LOCAL_ENABLED=false / OIDC_ENABLED=true
       -> Dex password login + Dex mockCallback group claim

Runtime/docs
  OIDC resolver -> loopback HTTP discovery only for localhost/127.0.0.1/[::1]
  Docs/AC -> optional OIDC front door onto existing session/API-key model

여기부터 보세요

  • docker-compose.test.yml, tests/oidc/dex-config.yaml — CI용 Dex IdP와 static client/password/mock group connector 설정
  • packages/web/playwright.oidc.config.ts, packages/web/e2e-oidc/oidc-flow.spec.ts — 실제 OIDC authorization-code e2e 및 정책/비회귀 케이스
  • packages/api/src/lib/auth/oidc.ts, packages/api/src/lib/auth/oidc.test.ts — loopback issuer 처리와 OIDC user 재사용/admin group 테스트
  • README.md, docs/ACCEPTANCE_CRITERIA.md, docs/ARCHITECTURE.md, docs/PRD.md — Authentik sign-off, AC-04 Verified, stale “not OIDC” 문구 정정

위험 & 롤백

  • 위험: auth/e2e test stack이 CI와 로그인 정책을 함께 건드립니다. Dex는 CI를 위한 경량 IdP이고, 실제 Authentik claim mapping은 문서화된 수동 sign-off 절차로 검증합니다.
  • 롤백: 이 PR revert로 Dex compose service, OIDC e2e runner, docs/AC 갱신, changeset을 되돌릴 수 있습니다.
  • 배포 주의: migration v1은 users table rebuild를 수행하므로 업그레이드 전에 evidence.db 백업이 필요합니다.

변경 파일

  • .changeset/curly-oidc-browsers.md
  • .env.example
  • README.md
  • docker-compose.test.yml
  • docs/ACCEPTANCE_CRITERIA.md
  • docs/ARCHITECTURE.md
  • docs/PRD.md
  • package.json
  • packages/api/src/lib/auth/oidc.test.ts
  • packages/api/src/lib/auth/oidc.ts
  • packages/api/src/lib/mcp/llm-text.test.ts
  • packages/api/src/lib/mcp/llm-text.ts
  • packages/web/e2e-oidc/oidc-flow.spec.ts
  • packages/web/package.json
  • packages/web/playwright.oidc.config.ts
  • tests/oidc/dex-config.yaml

Evidence

  • npm run lint — pass
  • npm test — pass
  • npm run build — pass
  • npm run e2e — pass (기존 Playwright 12건 + Dex OIDC 2건)
  • Stale OIDC denial scan — pass
  • Evidence upload — pass (/w/default/b/20260821-0216-feat-168-oidc-idp-stack-attempt1 로컬 업로드/metadata 200)
  • Changeset: .changeset/curly-oidc-browsers.md — bump patch (inferred: test-stack/docs verification plus MCP auth guidance update)

Issues

머지 후/사람 확인

  • 실제 운영 Authentik 인스턴스에서 README의 Authentik 2026.8.0 절차로 수동 재검증하세요. 자동 CI는 issue 요구대로 경량 Dex IdP를 사용합니다.

@moncher-dev
moncher-dev marked this pull request as ready for review August 21, 2026 02:27
@hojinzs
hojinzs self-requested a review August 21, 2026 02:40

@hojinzs hojinzs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Project #14 watchdog review — approve

Reviewed PR #178 at head 0c837d9cfc7e11743629a808bd060f641bf492d6 against main.

No concrete blocking OIDC/auth, security, correctness, or regression finding was identified. The PR adds the Dex authorization-code flow, user reuse/admin-group regression coverage, and loopback-only local test support without exposing production credentials.

Verification performed:

  • npm run lint — passed
  • npm test — shared 53, API 204, web 29, CLI 51 passed
  • npm run build — passed
  • Playwright test discovery — 2 OIDC tests discovered
  • Preview root — HTTP 200
  • Preview /api/health — HTTP 200, status ok
  • GitHub CI checks including e2e — successful on this head

The local OIDC E2E could not start because the Docker daemon was unavailable; this is recorded as environmental/inconclusive in the evidence bundle, while the corresponding GitHub e2e check is green.

Evidence Browser bundle: https://evidence-browser.dev0.daniworks.kr/w/evidence-browser/b/project14-pr-178-20260821-023840z

The PR is not low-risk for automatic Land because it changes authentication/API/test infrastructure. I am approving it but leaving Project status in In review for Steve's Land decision.

@hojinzs hojinzs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

요구사항 검증 (Issue #168)

이슈 스코프 4개 항목 모두 충족을 확인했습니다.

  1. 테스트 스택 IdP: docker-compose.test.ymldexidp/dex:v2.44.0 서비스 추가, tests/oidc/dex-config.yaml에 static client/password/mock group connector 구성 — 완료.
  2. Authentik sign-off 문서: README에 Authentik 2026.8.0 기준 provider/application 생성, redirect URI, group claim mapping 절차 기록 — 완료.
  3. AC-04 검증: docs/ACCEPTANCE_CRITERIA.md:309가 evidence 번들 링크(/w/default/b/20260821-0216-...)와 함께 Verified로 갱신됨. 매트릭스(구 787라인 부근) Auth OIDC 컬럼은 기존에 이미 정확히 표기되어 있어 추가 수정 불필요 — 완료.
  4. Happy-path 이외 QA 케이스: 첫 로그인 자동 프로비저닝, 두 번째 로그인 동일 row 재사용(신규 unit test), admin group→role 매핑(신규 unit test + e2e), allowlist 밖 그룹 거부(기존 unit test rejects users outside configured allowed groups), AUTH_LOCAL_ENABLED=false 시 password 로그인 차단이면서 SSO는 동작(e2e), API-key bundle upload 비회귀(e2e) — 모두 커버됨.

이슈 요구사항을 벗어난 임의의 오버엔지니어링은 발견되지 않았습니다. oidc.tsisLoopbackIssuer/allowInsecureRequests 추가는 명시적 요구사항은 아니지만 Dex가 plain HTTP인 loopback 환경에서 CI e2e가 동작하도록 하는 데 필요한 최소한의 기술적 인에이블러이고, 프로덕션 이슈어(HTTPS)에는 영향이 없도록 hostname으로 엄격히 스코프되어 있어 문제 없다고 판단했습니다.

Smoke Test

  • Preview 환경: PR 코멘트의 preview URL(evidence-browser-pr-178.dev0.daniworks.kr)에 접근을 시도했으나 이 리뷰 세션의 네트워크 정책상 아웃바운드 연결이 차단(403)되고 별도 계정 정보도 제공되지 않아 접근 불가했습니다.
  • 대체 검증: 로컬에서 npm -w @evidence-browser/api run testoidc.test.ts, llm-text.test.ts 포함 204개 테스트 전체 통과 확인. 이 샌드박스에는 Docker 데몬이 없어 e2e:oidc(Dex 컨테이너 기반) 자체는 로컬 재현이 불가능했으나, 해당 워크플로가 이미 GitHub Actions e2e job에서 green으로 통과했고(docker compose -f docker-compose.test.yml up oidc를 포함한 npm run e2e 체인), lint/build/typecheck/coverage/changeset job 모두 green임을 확인했습니다.

코드 품질 리뷰

P1/P2/P3 이슈는 발견되지 않았습니다. packages/api/src/lib/auth/oidc.tsisLoopbackIssuer에 nit 하나만 인라인 코멘트로 남겼습니다 (죽은 분기, 기능 영향 없음).

결론

Approve합니다. 요구사항 반영이 충실하고, 회귀 없이 CI가 green이며, 발견된 이슈는 머지를 막을 수준이 아닌 nit 1건뿐입니다.


Generated by Claude Code

return (
hostname === "localhost" ||
hostname === "127.0.0.1" ||
hostname === "::1" ||

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

nit: In Node, new URL(...).hostname for an IPv6 literal always includes the brackets (new URL('http://[::1]:5556').hostname === '[::1]'), so this hostname === "::1" branch never actually matches — the bracketed check right below already covers the real case. Harmless dead branch, not a functional bug; could drop this line for clarity.


Generated by Claude Code

@moncher-dev
moncher-dev merged commit c9b7e42 into main Aug 21, 2026
9 checks passed
@moncher-dev
moncher-dev deleted the feat/168-oidc-idp-stack branch August 21, 2026 02:54
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.

[E10·WP4] Authentik/mock IdP in the test stack, AC-04 verification, docs

2 participants