Skip to content

Main#65

Merged
jiminnimij merged 10 commits into
developfrom
main
Mar 4, 2026
Merged

Main#65
jiminnimij merged 10 commits into
developfrom
main

Conversation

@jiminnimij
Copy link
Copy Markdown
Contributor

#️⃣ 연관된 이슈

관련된 이슈 번호를 적어주세요. 예: #이슈번호

#️⃣ 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요. (이미지 첨부 가능)

#️⃣ 테스트 결과

코드 변경에 대해 테스트를 수행한 결과를 요약해주세요. 예: 모든 테스트 통과 여부, 새로 작성한 테스트 케이스 등

#️⃣ 변경 사항 체크리스트

  • 코드에 영향이 있는 모든 부분에 대한 테스트를 작성하고 실행했나요?
  • 문서를 작성하거나 수정했나요? (필요한 경우)
  • 코드 컨벤션에 따라 코드를 작성했나요?
  • 본 PR에서 발생할 수 있는 모든 의존성 문제가 해결되었나요?

#️⃣ 스크린샷 (선택)

관련된 스크린샷이 있다면 여기에 첨부해주세요.

#️⃣ 리뷰 요구사항 (선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요.
예시: 이 부분의 코드가 잘 작동하는지 테스트해 주실 수 있나요?

📎 참고 자료 (선택)

관련 문서, 스크린샷, 또는 예시 등이 있다면 여기에 첨부해주세요

@jiminnimij jiminnimij merged commit 496c9a9 into develop Mar 4, 2026
2 checks passed
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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은 Google OAuth 로그인 처리 로직을 개선하고 Spring Security 설정을 리팩토링하여 애플리케이션의 보안 구성을 더욱 명확하고 효율적으로 만들었습니다. 특히, OAuth 리다이렉트 URL 처리의 견고성을 높이고, Swagger와 일반 API 엔드포인트에 대한 보안 정책을 분리하여 관리의 용이성을 확보했습니다.

Highlights

  • Google OAuth 로그인 로직 개선: Google OAuth 로그인 처리 시 redirectUrlstate 파라미터에서 디코딩하도록 변경하여, URL 인코딩 문제를 해결하고 보안을 강화했습니다.
  • Spring Security 설정 리팩토링: 보안 필터 체인을 Swagger와 API 엔드포인트에 대해 두 개의 독립적인 체인으로 분리하고, @Order 어노테이션을 사용하여 각 체인의 처리 순서를 명시했습니다.
Changelog
  • src/main/java/net/studioxai/studioxBe/domain/auth/service/OauthService.java
    • UriUtils 및 StandardCharsets를 임포트했습니다.
    • loginWithGoogle 메서드의 redirectUrl 파라미터를 state로 변경했습니다.
    • state 파라미터를 UTF-8로 디코딩하여 실제 리다이렉트 URL로 사용하도록 수정했습니다.
    • 디코딩된 URL을 검증 및 GoogleCallbackDto 생성에 적용했습니다.
  • src/main/java/net/studioxai/studioxBe/global/config/SecurityConfig.java
    • @order 어노테이션과 withDefaults 정적 임포트를 추가했습니다.
    • 기존의 단일 securityFilterChainswaggerFilterChainapiFilterChain 두 개로 분리했습니다.
    • swaggerFilterChainSwaggerPatterns에 매칭되며, 프로덕션 환경에서는 인증을 요구하고 그 외 환경에서는 모두 허용하도록 설정했습니다.
    • apiFilterChain/api/** 경로에 매칭되며, 일반적인 API 접근 권한 설정을 처리합니다.
    • 두 필터 체인에 @Order 어노테이션을 부여하여 실행 순서를 명시했습니다.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/deploy.yml
Activity
  • 아직 이 PR에 대한 사람의 활동(댓글, 리뷰 등)은 없습니다.
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
Copy Markdown
Contributor

@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

This pull request aims to improve redirect URL handling in the OAuth service and clarify security policies for Swagger and API endpoints by separating Spring Security configuration into two SecurityFilterChains. While the PR introduces a change to decode the state parameter for redirect URL validation, a security audit identified an Open Redirect vulnerability in the OAuth callback logic, indicating that the validation might still be insufficient. Additionally, the audit highlighted other critical issues, including the exposure of a potentially sensitive /env endpoint to the public and the disabling of CSRF protection while using cookie-based authentication. These vulnerabilities should be addressed to protect user data and maintain application integrity.

.anyRequest().authenticated()
);
.securityMatcher("/api/**")
.csrf(AbstractHttpConfigurer::disable)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

CSRF protection is explicitly disabled for the API (/api/**). However, the JwtAuthenticationFilter is configured to resolve the authentication token from cookies. This combination makes the application vulnerable to Cross-Site Request Forgery (CSRF) attacks, as an attacker can trick a logged-in user's browser into making unauthorized requests to the API.

http.authorizeHttpRequests(auth -> auth
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.requestMatchers(HttpMethod.GET, GetPermitPatterns).permitAll()
.requestMatchers(PermitAllPatterns).permitAll()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The PermitAllPatterns array includes the /env path, which is then permitted for all users in the apiFilterChain. In Spring Boot applications, the /env endpoint (often part of Actuator) can expose sensitive environment variables, including database credentials, API keys, and other secrets. Exposing this endpoint publicly is a significant security risk.


String decodedRedirectUrl = UriUtils.decode(state, StandardCharsets.UTF_8);

validateRedirectUrl(decodedRedirectUrl);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The loginWithGoogle method decodes the state parameter and uses it as a redirect URL. The validation performed by validateRedirectUrl uses startsWith, which can be bypassed (e.g., http://localhost:3000.evil.com starts with http://localhost:3000). This allows an attacker to redirect users to a malicious site after a successful login.

}
else {
.authorizeHttpRequests(auth -> auth.anyRequest().authenticated())
.httpBasic(withDefaults());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

swaggerFilterChain 내에서 httpBasic(withDefaults())가 중복으로 호출되고 있습니다. 이미 85번 라인에서 설정되었으므로, isProdProfile() 조건문 안의 이 호출은 제거해도 무방합니다. 중복 호출은 기능상 문제는 없지만, 코드의 명확성을 위해 제거하는 것이 좋습니다.

Suggested change
.httpBasic(withDefaults());
.authorizeHttpRequests(auth -> auth.anyRequest().authenticated())

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.

2 participants