Skip to content

Comments

[refactor] userID, password 조건 변경#1242

Merged
lepitaaar merged 2 commits intodevelop/befrom
refactor/#1241-id-password-condition-change-MOA-682
Feb 25, 2026
Merged

[refactor] userID, password 조건 변경#1242
lepitaaar merged 2 commits intodevelop/befrom
refactor/#1241-id-password-condition-change-MOA-682

Conversation

@lepitaaar
Copy link
Contributor

@lepitaaar lepitaaar commented Feb 25, 2026

#️⃣연관된 이슈

📝작업 내용

참고자료
https://item4.blog/2023-09-20/password-the-right-way/

기존의 id,password의 조건이 과하게 강하게 설정되어있다 판단되어 완화하였습니다

  1. UserId
  • 길이: 5~20자
  • 필수 포함: 소문자 1개 이상
  • 숫자: 선택
  • 특수문자: 선택 (! @ # $ ~만 허용)
  • 허용 문자 전체: 영문 대소문자, 숫자, !@#$~
  • 공백/기타 특수문자(^, *, % 등) 불가
  1. Password
  • 길이: 8자 이상 (상한 없음)
  • 필수 포함: 영문 1개 이상 + 숫자 1개 이상
  • 특수문자: 허용, 필수 아님 (종류 제한 없음)
  • 공백 불가

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

릴리스 노트

  • 개선 사항
    • 비밀번호 정책 완화: 특수문자 요구사항 제거, 최대 길이 제한 해제 (8자 이상)
    • 사용자 ID 정책 완화: 숫자 포함 요구사항을 선택사항으로 변경

---
최소 8자 (상한 없음)
영문자 1개 이상 + 숫자 1개 이상 필수
공백 문자 불가
특수문자는 허용, 필수 아님, 종류 제한 없음
null/빈 문자열 불가
---
길이: 5~20자
필수 포함: 소문자 1개 이상
숫자: 선택
특수문자: 선택 (! @ # $ ~만 허용)
허용 문자 전체: 영문 대소문자, 숫자, !@#$~
공백/기타 특수문자(^, *, % 등) 불가
@lepitaaar lepitaaar self-assigned this Feb 25, 2026
@lepitaaar lepitaaar added 🔨 Refactor 코드 리팩토링 💾 BE Backend labels Feb 25, 2026
@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moadong Ready Ready Preview, Comment Feb 25, 2026 3:28am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

비밀번호 및 사용자 ID 검증 규칙을 완화합니다. 비밀번호는 특수문자 요구사항을 제거하고 최대 길이 제한을 없애며, 사용자 ID는 숫자를 선택사항으로 변경합니다. 검증 로직, 엔티티 제약조건, API 문서, 테스트를 일관되게 업데이트합니다.

Changes

Cohort / File(s) Summary
비밀번호 검증 로직 완화
backend/src/main/java/moadong/global/validator/PasswordValidator.java, backend/src/main/java/moadong/user/entity/User.java, backend/src/main/java/moadong/user/view/UserSwaggerView.java
비밀번호 정규식에서 특수문자([!@#$%^]) 요구사항 제거 및 최대 길이(20자) 제약 제거. 최소 8자 이상, 최소 하나의 문자와 숫자 포함 조건 유지. User 엔티티의 @Size 제약조건과 Swagger 문서 일관되게 업데이트.
사용자 ID 검증 패턴 변경
backend/src/main/java/moadong/global/validator/UserIdValidator.java
USER_ID_PATTERN에서 숫자 필수 요구사항 제거. 최소 하나의 소문자 필수, 길이 5–20자, 허용 문자 [A-Za-z0-9!@#$~] 유지.
검증 테스트 업데이트
backend/src/test/java/moadong/unit/user/PasswordValidatorTest.java, backend/src/test/java/moadong/unit/user/UserRegisterTest.java
PasswordValidatorTest를 매개변수화 테스트로 전환하여 다양한 비밀번호 사례 검증. UserRegisterTest에서 유효한 userId 테스트 케이스 추가 및 검증 규칙 설명 업데이트.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

✅ Test

Suggested reviewers

  • PororoAndFriends
  • Due-IT
  • Zepelown
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 풀 리퀘스트 제목은 주요 변경 사항을 명확하게 요약하고 있습니다. '[refactor] userID, password 조건 변경'은 userId와 password 검증 규칙 변경이라는 핵심 내용을 간결하고 구체적으로 전달합니다.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#1241-id-password-condition-change-MOA-682

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 and usage tips.

@github-actions
Copy link

Test Results

94 tests   94 ✅  16s ⏱️
23 suites   0 💤
23 files     0 ❌

Results for commit f852901.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
backend/src/test/java/moadong/unit/user/UserRegisterTest.java (1)

179-183: ⚠️ Potential issue | 🟡 Minor

에러 메시지 복사-붙여넣기 오류

회원가입시_유저_비밀번호가_조건에_맞지_않으면_실패한다 메서드 내에서 "유효하지 않은 userId: " + userId라는 메시지를 출력합니다. 파라미터는 password이므로 메시지와 변수 모두 수정이 필요합니다.

🐛 수정 제안
-                fail("예외나 검증 실패가 발생하지 않았습니다. 유효하지 않은 userId: " + userId);
+                fail("예외나 검증 실패가 발생하지 않았습니다. 유효하지 않은 password: " + password);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/test/java/moadong/unit/user/UserRegisterTest.java` around lines
179 - 183, In the test method 회원가입시_유저_비밀번호가_조건에_맞지_않으면_실패한다 in
UserRegisterTest.java update the failure message and variable used: replace the
string concatenation that currently says "유효하지 않은 userId: " + userId with the
correct parameter and variable for this test, e.g. "유효하지 않은 password: " +
password, and ensure any reference to the variable userId in that fail() call is
changed to password so the message and variable match the test's intent.
🧹 Nitpick comments (1)
backend/src/main/java/moadong/user/entity/User.java (1)

43-45: 엔티티 @Size 제약은 실질적으로 무효

password 필드에 붙은 @Size(min = 8)은 BCrypt로 인코딩된 해시(항상 60자)에 대해 검증되므로 항상 통과합니다. 실제 정책 강제는 UserRegisterRequest@Password 검증기에서 이루어집니다. 엔티티 레벨 제약은 불필요하거나, 의도가 있다면 주석으로 명시하는 것이 좋습니다.

♻️ 불필요한 `@Size` 제약 제거 제안
     `@NotNull`
-    `@Size`(min = 8)
     private String password;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/java/moadong/user/entity/User.java` around lines 43 - 45,
엔티티 User의 password 필드에 있는 `@Size`(min = 8) 제약은 BCrypt 해시(항상 ~60자)에 대해 항상 통과하므로 실효가
없습니다; UserRegisterRequest의 `@Password` 검증기에서 실제 정책을 적용하므로 User.password의 `@Size` 주석을
제거하거나(권장) 해당 의도가 있다면 User 클래스의 password 필드 위에 주석으로 의도와 이유를 명시하세요 (참조: class
User, field password 및 UserRegisterRequest/@Password validator).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@backend/src/main/java/moadong/user/view/UserSwaggerView.java`:
- Around line 23-26: Update the Swagger documentation string in
UserSwaggerView.java to refer to "아이디" instead of "이메일" so it matches the actual
validation logic in UserRegisterRequest and UserCommandService; specifically
replace the phrase "이메일과 동일한 비밀번호 불가" with "아이디와 동일한 비밀번호 불가" to align with the
PASSWORD_SAME_AS_USERID error code and related tests.

In `@backend/src/test/java/moadong/unit/user/UserRegisterTest.java`:
- Around line 164-169: The test includes UserFixture.collectUserId ("test1112")
in the invalid-password cases but that value now matches the relaxed
PasswordValidator regex (^(?=.*[a-zA-Z])(?=.*[0-9])(?!.*\\s).{8,}$), so the test
fails; update the parameter set in UserRegisterTest to remove
UserFixture.collectUserId or replace it with a truly invalid password (e.g., no
digits, no letters, or contains whitespace) so the violations assertion behaves
as intended and references remain clear (UserRegisterTest,
UserFixture.collectUserId, PasswordValidator).
- Around line 128-131: The test uses UserFixture.collectPassword ("test1112@")
which actually satisfies UserIdValidator's pattern and makes the test
unexpectedly pass; update the test in UserRegisterTest to remove this misleading
case or replace UserFixture.collectPassword with a truly invalid value (e.g., a
string containing a character not in [!@#$~] such as '%' or '^' or '*'),
ensuring the failing-case list contains an input that will not match the regex
so violations.isEmpty() will be false.

---

Outside diff comments:
In `@backend/src/test/java/moadong/unit/user/UserRegisterTest.java`:
- Around line 179-183: In the test method 회원가입시_유저_비밀번호가_조건에_맞지_않으면_실패한다 in
UserRegisterTest.java update the failure message and variable used: replace the
string concatenation that currently says "유효하지 않은 userId: " + userId with the
correct parameter and variable for this test, e.g. "유효하지 않은 password: " +
password, and ensure any reference to the variable userId in that fail() call is
changed to password so the message and variable match the test's intent.

---

Nitpick comments:
In `@backend/src/main/java/moadong/user/entity/User.java`:
- Around line 43-45: 엔티티 User의 password 필드에 있는 `@Size`(min = 8) 제약은 BCrypt 해시(항상
~60자)에 대해 항상 통과하므로 실효가 없습니다; UserRegisterRequest의 `@Password` 검증기에서 실제 정책을 적용하므로
User.password의 `@Size` 주석을 제거하거나(권장) 해당 의도가 있다면 User 클래스의 password 필드 위에 주석으로 의도와
이유를 명시하세요 (참조: class User, field password 및 UserRegisterRequest/@Password
validator).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between aff80a1 and f852901.

📒 Files selected for processing (6)
  • backend/src/main/java/moadong/global/validator/PasswordValidator.java
  • backend/src/main/java/moadong/global/validator/UserIdValidator.java
  • backend/src/main/java/moadong/user/entity/User.java
  • backend/src/main/java/moadong/user/view/UserSwaggerView.java
  • backend/src/test/java/moadong/unit/user/PasswordValidatorTest.java
  • backend/src/test/java/moadong/unit/user/UserRegisterTest.java

Copy link
Member

@seongwon030 seongwon030 left a comment

Choose a reason for hiding this comment

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

완화된것 관리자들에게 알리면 좋겠네요

@lepitaaar lepitaaar merged commit e51f8c5 into develop/be Feb 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💾 BE Backend 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants