Skip to content

refactor: codebase#24

Merged
AlphaBs merged 1 commit intodevelopfrom
refactor/code
Jan 10, 2026
Merged

refactor: codebase#24
AlphaBs merged 1 commit intodevelopfrom
refactor/code

Conversation

@AlphaBs
Copy link
Member

@AlphaBs AlphaBs commented Jan 10, 2026

작업 내용

변경 사항

관련 이슈

closes #

@gemini-code-assist
Copy link

Summary of Changes

Hello @AlphaBs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 코드베이스의 전반적인 리팩토링을 목표로 합니다. 특히, 관리자 및 개발용 API의 설명을 명확히 하고, Google OAuth 인증 흐름의 로직을 서비스 계층으로 이동하여 컨트롤러의 역할을 간소화했습니다. 또한, 개발용 인증 컨트롤러의 기능을 재구성하여 테스트 사용자 관리 및 토큰 발급 과정을 보다 체계적으로 만들었습니다. 이러한 변경사항은 코드의 가독성, 유지보수성 및 책임 분리를 개선하는 데 기여합니다.

Highlights

  • 관리자 및 개발용 API 설명 개선: AdminTestController 및 DevAuthController의 @tag@operation 설명을 더 명확하고 간결하게 변경했습니다.
  • 인증 로직 리팩토링: Google OAuth 로그인 및 콜백 처리 로직을 AuthController에서 AuthService로 이동시켜 책임 분리를 강화했습니다.
  • 개발용 인증 API 재구성: DevAuthController에서 테스트 사용자 생성 및 토큰 발급 로직을 분리하고, 기존 사용자에게만 토큰을 발급하도록 변경했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이번 PR은 컨트롤러의 비즈니스 로직을 서비스 계층으로 옮기는 등 코드베이스를 전반적으로 리팩터링하여 코드 구조와 유지보수성을 개선했습니다. 또한 Swagger 문서도 명확하게 개선되었습니다. 하지만 DevAuthController에서 조건부 활성화 로직이 제거되어 프로덕션 환경에서 개발용 API가 노출될 수 있는 심각한 보안 문제가 발견되었습니다. 이 외에도 파라미터 유효성 검사 및 코드 일관성과 관련하여 몇 가지 개선점을 제안합니다.

@RequestMapping("/auth/dev")
@RequiredArgsConstructor
@ConditionalOnProperty(name = "app.dev-auth.enabled", havingValue = "true", matchIfMissing = false)
public class DevAuthController {

Choose a reason for hiding this comment

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

security-critical critical

@ConditionalOnProperty 애노테이션이 제거되어 DevAuthController가 항상 활성화되도록 변경되었습니다. 이 컨트롤러는 테스트용 계정 생성 및 토큰 발급과 같은 개발용 기능을 제공하므로, 프로덕션 환경에 배포될 경우 심각한 보안 취약점이 될 수 있습니다. 프로덕션 환경에서는 이 컨트롤러가 비활성화되도록 app.dev-auth.enabled 프로퍼티를 사용하여 조건부로 활성화하는 기존 로직을 복원하는 것을 강력히 권장합니다.

Suggested change
public class DevAuthController {
@ConditionalOnProperty(name = "app.dev-auth.enabled", havingValue = "true", matchIfMissing = false)
public class DevAuthController {

});
isNewUser = user.getId() == null;
}
@RequestParam(required = false) Long userId) {

Choose a reason for hiding this comment

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

high

issueDevToken 메소드의 userId 파라미터가 @RequestParam(required = false)로 설정되어 있어 선택적으로 전달할 수 있습니다. 하지만 userId가 전달되지 않으면 findExistingDevUser 메소드에서 MEMBER_NOT_FOUND 예외가 발생합니다. 이 API의 목적이 "존재하는 userId로 JWT 토큰을 발급"하는 것이므로, userId는 필수 파라미터로 변경하는 것이 논리적으로 맞습니다. 이렇게 하면 API 사용자가 파라미터를 누락했을 때 더 명확한 에러 메시지를 받을 수 있습니다.

Suggested change
@RequestParam(required = false) Long userId) {
@RequestParam Long userId) {

Comment on lines +76 to 85
private User createTestUser() {
User testUser = User.builder()
.googleId("dev-test-user")
.email("test@dev.local")
.googleId("dev-test-user-" + UUID.randomUUID())
.email("test" + UUID.randomUUID() + "@dev.local")
.name("테스트유저")
.profileImage(null)
.role(role)
.role(Role.USER)
.build();
return userRepository.save(testUser);
}

Choose a reason for hiding this comment

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

medium

createTestUser 메소드에서 UUID.randomUUID()가 두 번 호출되어 googleIdemail에 서로 다른 UUID가 사용됩니다. 이는 기능적으로 큰 문제는 아니지만, 일관성을 위해 하나의 UUID를 생성하여 두 필드에 모두 사용하는 것이 좋습니다.

Suggested change
private User createTestUser() {
User testUser = User.builder()
.googleId("dev-test-user")
.email("test@dev.local")
.googleId("dev-test-user-" + UUID.randomUUID())
.email("test" + UUID.randomUUID() + "@dev.local")
.name("테스트유저")
.profileImage(null)
.role(role)
.role(Role.USER)
.build();
return userRepository.save(testUser);
}
private User createTestUser() {
String uniqueId = UUID.randomUUID().toString();
User testUser = User.builder()
.googleId("dev-test-user-" + uniqueId)
.email("test" + uniqueId + "@dev.local")
.name("테스트유저")
.profileImage(null)
.role(Role.USER)
.build();
return userRepository.save(testUser);
}

@AlphaBs AlphaBs merged commit 66c04bb into develop Jan 10, 2026
1 check passed
@AlphaBs AlphaBs deleted the refactor/code branch January 10, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant