Repository navigation
chore: 릴리즈 — 계정 아이디 대문자 허용 #527
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cc03ba8
feat: 계정 아이디에 영문 대문자 허용
chanwoo7 0e36600
Merge pull request #526 from CaQuick/feat/username-allow-uppercase
chanwoo7 fbac569
fix: 시드 username 검증을 생성 정책과 맞춤
chanwoo7 8e20ef8
Merge pull request #528 from CaQuick/fix/release-review-seed-username
chanwoo7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import 'reflect-metadata'; | ||
|
|
||
| import { plainToInstance } from 'class-transformer'; | ||
| import { validate } from 'class-validator'; | ||
|
|
||
| import { assertSeedCredential } from '../../prisma/seed/credential-policy'; | ||
|
|
||
| import { AdminCreateAdminInput } from '@/features/auth/dto/inputs/admin-create-admin.input'; | ||
|
|
||
| const PASSWORD = 'Strong!Pass1'; | ||
|
|
||
| function seedAccepts(username: string): boolean { | ||
| try { | ||
| assertSeedCredential({ username, password: PASSWORD }); | ||
| return true; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| async function dtoAccepts(username: string): Promise<boolean> { | ||
| const input = plainToInstance(AdminCreateAdminInput, { | ||
| username, | ||
| password: PASSWORD, | ||
| }); | ||
| return (await validate(input)).length === 0; | ||
| } | ||
|
|
||
| // 시드가 만든 계정이 관리자 생성 경로와 같은 username 정책을 따르는지 — 두 판정이 어긋나면 안 된다 | ||
| describe('시드 자격증명 username 정책', () => { | ||
| it.each([ | ||
| ['소문자', 'ops.admin', true], | ||
| ['대문자 혼용', 'Ops.Admin_1', true], | ||
| ['전부 대문자', 'OPS-ADMIN', true], | ||
| ['4자', 'abcd', true], | ||
| ['80자', 'a'.repeat(80), true], | ||
| ['3자', 'abc', false], | ||
| ['81자', 'a'.repeat(81), false], | ||
| ['공백', 'ops admin', false], | ||
| ['허용 외 문자(@)', 'ops@admin', false], | ||
| ['한글', '관리자계정', false], | ||
| ])('%s: 생성 DTO와 같은 판정(%s → %s)', async (_label, username, ok) => { | ||
| expect(seedAccepts(username)).toBe(ok); | ||
| expect(await dtoAccepts(username)).toBe(ok); | ||
| }); | ||
|
|
||
| it('위반 메시지에 username 값을 싣지 않는다', () => { | ||
| expect(() => | ||
| assertSeedCredential({ username: 'bad@name', password: PASSWORD }), | ||
| ).toThrow(/^시드 username 정책 위반: 4~80자/); | ||
| expect(() => | ||
| assertSeedCredential({ username: 'bad@name', password: PASSWORD }), | ||
| ).not.toThrow(/bad@name/); | ||
| }); | ||
|
|
||
| it('password 정책 위반은 별도 메시지로 거절한다', () => { | ||
| expect(() => | ||
| assertSeedCredential({ username: 'ops.admin', password: 'weak' }), | ||
| ).toThrow(/^시드 password 정책 위반/); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When
ADMIN_SEED_USERNAMEcontains a newly valid mixed-case value such asOps.Admin,seedAdminsstill passes it toprisma/seed/credential-policy.ts, whose lowercase-only regex throws before the account is inserted. This leaves the documented optional admin-seeding path unable to use the username policy introduced here; update that validator and its error message, preferably by reusing the shared policy.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.
반영: 시드 username 검증이 생성 정책(USERNAME_PATTERN·길이 상수)을 직접 쓰도록 바꿈 — fix/release-review-seed-username → develop PR로 반영 후 이 릴리즈에 포함.