Skip to content

[App] 회원가입 페이지/기능 구현#70

Merged
codingbaraGo merged 3 commits intomainfrom
feat/app/page-register/#65
Jan 15, 2026
Merged

[App] 회원가입 페이지/기능 구현#70
codingbaraGo merged 3 commits intomainfrom
feat/app/page-register/#65

Conversation

@codingbaraGo
Copy link
Owner

💻 작업 내용

  • 유저 레포지토리 추가
  • 입력값 길이 유효성 검사 추가
  • 중복검사 추가

🎯 관련 이슈

closed #65

@codingbaraGo codingbaraGo self-assigned this Jan 15, 2026
@codingbaraGo codingbaraGo added the feature New feature or request label Jan 15, 2026
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

회원가입 기능 구현 검토 완료입니다.

Comment on lines +55 to +57
return params.getQueryValue(key)
.orElseThrow(() -> new ServiceException(ErrorCode.MISSING_REGISTER_TOKEN, key + " required"));
}

Choose a reason for hiding this comment

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

중복검사 성능 문제: findByColumn()을 각각 호출할 때마다 데이터베이스 쿼리가 2번 발생합니다. 비용이 큰 작업이므로 검사 순서를 조정하거나 길이 검증을 먼저 수행한 후 중복 검사를 하는 것이 좋습니다(유효하지 않은 데이터로 불필요한 DB 쿼리 방지).

또한 findByColumn(EMAIL, email) 호출 시 문자열 리터럴 "email"을 사용하는데, 이는 EMAIL 상수와 불일치할 위험이 있습니다. 상수 값이 실제 DB 컬럼명과 정확히 일치하는지 확인이 필요합니다.

continue;
}
if ("id".equals(field.getName())) {
if ("id".equals(toColumnName(field.getName()))) {

Choose a reason for hiding this comment

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

논리 오류: 필드명 "id"를 snake_case로 변환한 결과와 비교하고 있지만, "id"는 변환해도 "id"이므로 실제로는 정상 동작합니다. 다만 명확성을 위해 변환 전 원본 필드명으로 비교하는 것이 낫습니다: if ("id".equals(field.getName())) 사용 권장.

Comment on lines 130 to +131
public List<T> findByColumn(String columnName, Object value) {
String sql = "SELECT * FROM " + tableName + " WHERE " + columnName + " = ?";
String sql = "SELECT * FROM " + tableName + " WHERE " + toColumnName(columnName) + " = ?";

Choose a reason for hiding this comment

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

SQL 인젝션 위험: 사용자 입력인 columnName 파라미터를 toColumnName()을 거쳐서 SQL에 직접 삽입하고 있습니다. toColumnName() 검증만으로는 충분하지 않습니다. 특수 문자 필터링이나 허용 목록 검증(whitelist)을 추가하거나, 더 안전한 메커니즘을 사용하세요.

logger.debug("{} - {}", error.getMessage(), error.getThrowable().toString());
ErrorCode errorCode = error.getErrorCode();
HttpStatus status = errorCode.getStatus();

Choose a reason for hiding this comment

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

응답 일관성 문제: ErrorCode.getMessage()로 변경했으나, 이전에 error.getMessage()에서 반환되던 값은 무엇인지 확인 필요합니다. 호출자가 원래 전달한 메시지를 의도했다면 정책 변경이 문제가 될 수 있습니다. 항상 ErrorCode 메시지만 반환할 것인지 명확히 정의하세요.

Comment on lines +15 to 22

public static final int EMAIL_MAX = 50;
public static final int EMAIL_MIN = 4;
public static final int NICKNAME_MAX = 12;
public static final int NICKNAME_MIN = 4;
public static final int PASSWORD_MAX = 16;
public static final int PASSWORD_MIN = 4;
}

Choose a reason for hiding this comment

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

하드코딩된 검증 값: 길이 제한이 상수로 고정되어 있습니다. 향후 변경 시 코드 수정이 필요하고, 외부 설정으로 관리되지 않습니다. 가능하면 데이터베이스나 설정 파일에서 로드하는 방식을 고려하세요.

Comment on lines +17 to +18
public User() {
}

Choose a reason for hiding this comment

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

ORM 패턴 일관성: 기본 생성자를 추가했는데, 이는 보통 ORM(Hibernate 등)의 리플렉션 기반 인스턴스화를 위해 필요합니다. 다른 엔티티도 동일하게 기본 생성자를 가지고 있는지 확인하세요. 불완전한 상태로 객체가 생성되지 않도록 접근 제어(private 또는 package-private)를 고려하세요.

codingbaraGo added a commit that referenced this pull request Jan 15, 2026
@codingbaraGo codingbaraGo merged commit f39c3ef into main Jan 15, 2026
1 of 2 checks passed
@codingbaraGo codingbaraGo deleted the feat/app/page-register/#65 branch January 15, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[App] - 회원가입 페이지 구현

1 participant

Comments