[hotfix] 구글 로그인 연동 문제 해결#49
Conversation
Summary of ChangesHello @seoahS01, 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 로그인 연동 문제를 해결하기 위해 Google OAuth 콜백 엔드포인트를 업데이트하고, OAuth 프로세스 중 리다이렉트 URL을 처리하는 방식을 개선합니다. 특히, 리다이렉트 URL이 Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly updates the Google login callback logic to use the state parameter instead of redirectUrl, which is a more secure and standard OAuth2 approach. However, this implementation introduces two security vulnerabilities: a high-severity OAuth CSRF vulnerability due to the lack of state nonce verification, and a medium-severity Open Redirect vulnerability due to weak validation of the redirect URL. Additionally, this change has broken existing test code, which needs to be updated to ensure the stability and correctness of the new implementation. Both the security vulnerabilities and the test failures must be addressed.
| } | ||
|
|
||
| public GoogleCallbackDto loginWithGoogle(String code, String redirectUrl) { | ||
| public GoogleCallbackDto loginWithGoogle(String code, String state) { |
There was a problem hiding this comment.
The loginWithGoogle method's change to use the state parameter introduces a high-severity OAuth CSRF vulnerability. The state parameter should contain a cryptographically secure random nonce that is verified upon callback to prevent CSRF attacks. Without this, an attacker can link a victim's session to an attacker-controlled account. Additionally, this signature change will break existing tests in OauthServiceTest, which need to be updated to properly handle the state parameter.
|
|
||
| String decodedRedirectUrl = UriUtils.decode(state, StandardCharsets.UTF_8); | ||
|
|
||
| validateRedirectUrl(decodedRedirectUrl); |
There was a problem hiding this comment.
The validateRedirectUrl method (called here) uses a weak prefix check (startsWith) to validate the redirect URL. This can be bypassed by an attacker using a domain that starts with a whitelisted entry (e.g., https://whitelisted.com.attacker.com). This allows for Open Redirect attacks, which can be used in phishing campaigns to redirect users to malicious sites after successful authentication. It is recommended to use a more robust validation that ensures the URL matches the whitelisted domain exactly or is a proper sub-path (e.g., by checking for a trailing slash).
#️⃣ 연관된 이슈
#48
#️⃣ 작업 내용
구글 로그인 연동 문제 해결
#️⃣ 테스트 결과
#️⃣ 변경 사항 체크리스트
#️⃣ 스크린샷 (선택)
#️⃣ 리뷰 요구사항 (선택)
📎 참고 자료 (선택)