Skip to content

feat: 시드가 기본 테스트 계정(관리자·판매자)을 항상 만들도록 - #538

Merged
chanwoo7 merged 1 commit into
developfrom
feat/seed-default-credentials
Oct 15, 2026
Merged

chanwoo7 merged 1 commit into
developfrom
feat/seed-default-credentials

Conversation

@chanwoo7

Copy link
Copy Markdown
Member

배경

  • 로컬에서 관리자 웹·판매자 앱을 테스트할 때마다 비밀번호를 직접 정해 .env에 넣고 시드를 돌려야 했습니다.
  • 사용자 결정으로 시드가 고정된 테스트 계정을 항상 만들도록 바꿉니다.
    • 관리자 admin, 판매자 seed-seller-a·seed-seller-b
    • 비밀번호는 모두 caquick1234!
  • 공개 레포에 값이 들어가지만, 운영 계정이 될 경로는 없습니다.
    • 시드는 NODE_ENV=production에서 차단됩니다.
    • 운영 DB는 외부 포트가 열려 있지 않습니다.
    • #304에서 정한 "비밀번호를 레포에 두지 않는다" 방침을 로컬 테스트 계정에 한해 바꾸는 것입니다.

변경

  • 환경변수 ADMIN_SEED_USERNAME·ADMIN_SEED_PASSWORD·SELLER_SEED_PASSWORD를 제거했습니다.
  • prisma/seed/credential-policy.ts에 기본값 상수(SEED_PASSWORD, SEED_ADMIN_USERNAME)를 두고, admins.ts·stores.ts가 이 값을 씁니다.
    • 판매자 라벨 스냅샷에는 아이디가 항상 붙습니다(자격증명이 항상 생기므로).
    • 시드 관리자 로그에 아이디를 함께 찍습니다.
  • README(한·영)의 환경변수 표에서 시드 행을 지우고, 설치 블록의 yarn prisma:seed 줄에 테스트 계정을 적었습니다.

테스트

  • src/test/seed-credential-policy.spec.ts: 기본 계정 3개가 시드 정책과 로그인 DTO(CredentialLoginInput)를 통과한다(3건).
  • src/test/seed-reset-scope.spec.ts: 기본 테스트 계정을 만들고 재시드해도 아이디가 겹치지 않고, 기본 비밀번호로 검증되며 비밀번호 변경을 강제하지 않는다(1건).
  • 반증: admins.ts·stores.ts를 env 방식으로 되돌리면 재시드 테스트가 실패하고(자격증명 없음), 적용하면 두 spec 23건이 모두 통과합니다.

플랜 대조

플랜 항목(docs-261015-234130-seed-default-credentials) 상태
1. 기본 자격증명 상수 1곳, admins.ts·stores.ts가 env 대신 상수 사용 한 것
2. 테스트: 기본 계정 정책 통과, 재시드 시 아이디 비충돌 한 것
3. README(한·영) 시드 행 삭제·계정 안내 한 것
4. 판매자 앱 README 이 PR 범위 밖 — caquick-seller-fe에서 별도 PR
5. 노션 가이드 갱신 이 PR 범위 밖 — 머지 뒤 진행
6. CodeQL 하드코딩 자격증명 알럿 처리 이 PR의 Analyze 결과를 보고 처리

- 로컬 관리자·판매자 테스트 때마다 비밀번호를 정해 .env에 넣던 단계를 없앰(사용자 결정). 관리자 admin, 판매자 seed-seller-a·b, 비밀번호 caquick1234!
- 환경변수 ADMIN_SEED_USERNAME·ADMIN_SEED_PASSWORD·SELLER_SEED_PASSWORD 제거. 공개 레포지만 시드는 NODE_ENV=production에서 막히고 운영 DB는 외부 포트가 없어 운영 계정이 되지 않음(#304의 '레포에 비밀번호를 두지 않는다' 방침을 로컬 계정에 한해 변경)
- credential-policy에 기본값 상수, admins·stores가 상수 사용(판매자 라벨에 아이디 항상 포함), README 한·영 환경변수 표에서 시드 행 삭제·설치 블록에 계정 안내
- 테스트 4건: 기본 계정 3개가 시드 정책·로그인 DTO 통과, 재시드해도 아이디가 겹치지 않고 기본 비밀번호로 검증. 반증: 시드를 env 방식으로 되돌리면 재시드 테스트 실패
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: CaQuick/caquick-be/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef5ad174-2c31-4570-af31-695f9b4182ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T14:51:02.242406Z ca61788 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

🧹 knip — dead-code 리포트

Unused exported types (1)
전체 리포트
Unused exported types (1)
RateLimitPolicy  type  src/global/rate-limit/index.ts:4:8

청소 후보(오탐 가능) · 기준 docs/guide/architecture-conventions.md

@github-actions

Copy link
Copy Markdown

🩺 NestJS Doctor — 90/100 (Excellent)

진단 487건 (error 13).

Category error warning info
architecture 1 1 44
correctness 0 268 0
performance 0 36 28
schema 0 0 76
security 12 21 0
architecture / security 상위 항목
  • error security/security/no-hardcoded-secrets: Variable 'SEED_PASSWORD' appears to contain a hardcoded secret.
  • error architecture/architecture/no-manual-instantiation: Manual instantiation of 'OutboxRepository' detected. Use dependency injection instead.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'IAuditLogRepository'.
  • warning security/security/no-exposed-env-vars: Direct 'process.env.NODE_ENV' access in 'AuthController'. Use ConfigService instead.
  • warning security/security/require-guards-on-endpoints: Endpoint 'start' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'callback' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'refresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'logout' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerLogin' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerRefresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerLogout' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'devIssueToken' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'adminLogin' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'adminRefresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'adminLogout' has no @UseGuards() at class or method level.

오탐 포함 가능 · 기준 docs/guide/architecture-conventions.md

@github-actions

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟢 Statements 98.02% 10791/11009
🟢 Branches 92.95% 4112/4424
🟢 Functions 97.55% 2150/2204
🟢 Lines 98.59% 9818/9958

Test suite run success

4303 tests passing in 387 suites.

Report generated by 🧪jest coverage report action from ca61788

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chanwoo7
chanwoo7 merged commit 56d15ce into develop Oct 15, 2026
18 checks passed
@chanwoo7
chanwoo7 deleted the feat/seed-default-credentials branch October 15, 2026 14:53
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