Skip to content

Conversation

wch-os
Copy link
Member

@wch-os wch-os commented Sep 23, 2025

Issues

Description

  • Auth API에서 사용되는 필드에 대한 유효성 검증 규칙을 담은 정적 파일 구현

    • 유효성 정책 정의 필드: 이메일, 비밀번호, 비밀번호 확인, 사용자명
  • 각 필드의 정규표현식, 길이, 메시지 정의


Review Points

  • 자유로운 리뷰 부탁드립니다.

How Has This Been Tested?

  • 포스트맨으로 정의한 정적 파일이 정상 응답되고 있음을 확인했습니다.

- 이메일, 비밀번호, 비밀번호 확인, 사용자명 필드에 대한 유효성 검증 규칙 추가
- 각 필드의 정규표현식, 길이, 메시지 정의
- 유효성 규칙 엔드포인트를 jwt 인가 없이 접근할 수 있도록 규칙 추가
- 엔드포인트를 auth 도메인에 맞추도록, validation-rules 파일 위치 수정
@wch-os wch-os added this to the ✨ General Backlog milestone Sep 23, 2025
@wch-os wch-os self-assigned this Sep 23, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds static validation rules for Auth API fields to enable synchronization of field validation policies between frontend and backend. The implementation provides a JSON configuration file containing validation rules for email, password, password confirmation, and username fields.

  • Added validation-rules.json static file with regex patterns, length constraints, and error messages for auth fields
  • Updated JWT filter configuration to allow public access to the validation rules endpoint

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
services/auth/application/src/main/resources/static/auth/validation-rules.json New static JSON file defining validation rules for email, password, passwordConfirm, and username fields
monolith/main-runner/src/main/resources/properties/jwt/blolet.jwt.filter.yml Added public access endpoint for validation-rules.json in JWT filter configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"type": "string",
"required": true,
"regexp": {
"pattern": "^[A-Za-z\\d!\"#$%&'()*+,\\-./:;<=>?@\\[\\]^_`{|}~]+$",
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The password regex pattern allows all special characters without requiring complexity rules (uppercase, lowercase, digits, special chars). Consider implementing stronger password complexity requirements for better security.

Suggested change
"pattern": "^[A-Za-z\\d!\"#$%&'()*+,\\-./:;<=>?@\\[\\]^_`{|}~]+$",
"pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]^_`{|}~])[A-Za-z\\d!\"#$%&'()*+,\\-./:;<=>?@\\[\\]^_`{|}~]+$",

Copilot uses AI. Check for mistakes.

Comment on lines +45 to +48
"messages": {
"required": "닉네임을 입력하십시오.",
"minLength": "닉네임은 최소 2자 이상이어야 합니다.",
"maxLength": "닉네임은 최대 8자까지 입력할 수 있습니다."
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The username field lacks pattern validation, which could allow problematic characters or formatting. Consider adding a regex pattern to restrict allowed characters (e.g., alphanumeric and safe special characters only).

Suggested change
"messages": {
"required": "닉네임을 입력하십시오.",
"minLength": "닉네임은 최소 2자 이상이어야 합니다.",
"maxLength": "닉네임은 최대 8자까지 입력할 수 있습니다."
"regexp": {
"pattern": "^[a-zA-Z0-9_-]+$",
"flags": "u"
},
"messages": {
"required": "닉네임을 입력하십시오.",
"minLength": "닉네임은 최소 2자 이상이어야 합니다.",
"maxLength": "닉네임은 최대 8자까지 입력할 수 있습니다.",
"regexp": "닉네임은 영문, 숫자, 밑줄(_), 또는 하이픈(-)만 사용할 수 있습니다."

Copilot uses AI. Check for mistakes.

Copy link
Member

@merge-simpson merge-simpson left a comment

Choose a reason for hiding this comment

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

@wch-os 님, 언제나 리즈너블한 제안과 작업 감사합니다.

이번 리뷰는 논의 후 다시 이어 가겠습니다!

Copy link
Member

Choose a reason for hiding this comment

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

💬 (On Discussion) 정적 파일 위치

어느 모듈에 두는 게 좋을지 논의 중입니다!

Copy link
Member

Choose a reason for hiding this comment

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

다음처럼 결정하였으니, 참고 부탁드립니다!


  • Domain 모듈에 두기
    단, 커스텀 정적 경로를 만들어 제공 (+ 실행 모듈에 정적배포 설정을 추가하여 제어)

배포 전략의 수정이 도메인 모듈에 영향을 주지 않기 위함.

Copy link
Member

@merge-simpson merge-simpson left a comment

Choose a reason for hiding this comment

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

수정하시면 다시 리뷰하겠습니다...!

Copy link
Member

Choose a reason for hiding this comment

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

다음처럼 결정하였으니, 참고 부탁드립니다!


  • Domain 모듈에 두기
    단, 커스텀 정적 경로를 만들어 제공 (+ 실행 모듈에 정적배포 설정을 추가하여 제어)

배포 전략의 수정이 도메인 모듈에 영향을 주지 않기 위함.

- 유효성 검증 규칙 파일은 도메인에 대한 유효성 정책이므로 domain 모듈 내에 위치하도록 수정

- 유효성 검증 규칙 파일을 배포 과정에서 domain 모듈의 추가 수정 없이 배포 전략을 유연하게 바꿀 수 있도록, /resources/validation 커스텀한 경로에 위치하도록 함
- /validation 으로 시작하는 모든 요청은 정적 파일을 조회하는 요청으로 간주하고, src/main/resources/validation의 커스텀한 경로 안에서 정적 파일을 조회해서 응답하도록 함
- jwt 액세스 토큰 없이 유효성 검증 파일에 접근할 수 있도록 규칙 추가
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

☀️ Auth > API 필드 유효성 정책 동기화를 위한 정적파일 추가

2 participants