Repository navigation
chore: 릴리즈 — 시드 기본 테스트 계정(관리자·판매자) #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,13 @@ import { | |
| USERNAME_PATTERN, | ||
| } from '@/features/auth/constants/auth-admin.constants'; | ||
|
|
||
| /** | ||
| * 로컬 테스트 계정(관리자 admin, 판매자 seed-seller-a·b)의 공통 비밀번호. | ||
| * 시드는 NODE_ENV=production에서 막히고 운영 DB는 외부에 열려 있지 않아, 공개 레포에 있어도 운영 계정이 되지 않는다. | ||
| */ | ||
| export const SEED_PASSWORD = 'caquick1234!'; | ||
| export const SEED_ADMIN_USERNAME = 'admin'; | ||
|
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
# seed 진입점의 환경 가드와 seedAdmins 호출 경로를 확인한다.
rg -n -C4 "NODE_ENV" prisma/seed.ts
rg -n -C3 "seedAdmins" prisma/seed.tsRepository: CaQuick/caquick-be Length of output: 945 시드 실행을 허용할 환경을 명시적으로 제한하세요.
- if (process.env.NODE_ENV === 'production') {
+ if (process.env.NODE_ENV !== 'development' && process.env.NODE_ENV !== 'test') {
throw new Error('seed는 production 환경에서 실행할 수 없습니다.');
}🧰 Tools🪛 Betterleaks (1.9.0)[high] 16-16: Detected a potential hardcoded password literal, which may expose account credentials. (generic-password) 🤖 Prompt for AI AgentsSources: Learnings, Linters/SAST tools
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 미반영(기록): 로컬 시드는 NODE_ENV 없이 돌아(.env·스크립트 모두 미설정) development·test 허용 목록은 로컬 시드를 막음. 운영 이미지는 ENV NODE_ENV=production이라 일부러 덮어쓰지 않으면 차단되고, 운영 MySQL은 compose 네트워크 밖 포트가 없음. DB 호스트 기준 가드 같은 강화는 새 장치라 #540으로. |
||
|
|
||
| export function assertSeedCredential(args: { | ||
| username: string; | ||
| password: string; | ||
|
|
@@ -19,7 +26,7 @@ export function assertSeedCredential(args: { | |
| username.length > MAX_USERNAME_LENGTH || | ||
| !USERNAME_PATTERN.test(username) | ||
| ) { | ||
| // 값은 메시지에 싣지 않는다 — env에서 온 자격증명이 오류 로그로 새는 경로(CodeQL clear-text-logging) | ||
| // 값은 메시지에 싣지 않는다(CodeQL clear-text-logging) | ||
| throw new Error( | ||
| `시드 username 정책 위반: ${MIN_USERNAME_LENGTH}~${MAX_USERNAME_LENGTH}자, 영문 대소문자·숫자·._- 만 허용`, | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an existing non-seed credential already owns
admin—a common local username—the uniqueAccountCredential.usernameconstraint makes this insert fail after the reset and nearly the entire seed have already run; the newly created seed-admin account is also left without credentials. The same problem occurs earlier forseed-seller-aorseed-seller-b. SinceresetSeedScopedeliberately preserves non-seed accounts, preflight these fixed usernames before destructive work or handle collisions without leaving a partial seed.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
미반영(기록): 고정 아이디 충돌은 사용자가 알고 고른 트레이드오프이며 가이드 트러블슈팅에 안내함. 실패해도 재실행 시 resetSeedScope가 시드 관리자·판매자를 다시 정리해 상태가 쌓이지 않음 — 버그·계약 위반이 아닌 사전 점검 개선이라 #540으로.