-
Notifications
You must be signed in to change notification settings - Fork 0
merge to main #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge to main #94
Conversation
Summary of ChangesHello @jiminnimij, 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! This pull request enhances the security posture of the application by implementing a dedicated authentication challenge for Swagger-related endpoints. It ensures that access to API documentation and UI is properly controlled by prompting for basic authentication when an unauthenticated request is made to these specific paths. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이 PR은 Swagger 엔드포인트에 대한 인증되지 않은 접근을 처리하기 위해 CustomAuthenticationEntryPoint를 수정합니다. 변경 사항은 Swagger 경로에 대한 요청에 대해 브라우저에서 기본 인증 프롬프트를 트리거하도록 WWW-Authenticate 헤더와 함께 401 상태 코드를 반환합니다. 이는 올바른 접근 방식입니다. 코드의 유지보수성을 높이기 위해 Swagger 경로 목록을 확인하는 방식을 개선하는 것이 좋습니다. 아래에 자세한 리뷰 의견을 남겼습니다.
| if (path.startsWith("/v3/api-docs") | ||
| || path.startsWith("/swagger-ui") | ||
| || path.startsWith("/swagger-ui.html") | ||
| || path.startsWith("/swagger-resources") | ||
| || path.startsWith("/webjars")) { | ||
|
|
||
| response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); | ||
| response.setHeader( | ||
| "WWW-Authenticate", | ||
| "Basic realm=\"Swagger API\"" | ||
| ); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 구현은 여러 || 연산자를 사용하여 Swagger 경로를 확인하고 있어 가독성이 떨어지고 유지보수가 어렵습니다. 이 로직을 경로 배열과 반복문을 사용하도록 리팩토링하면 코드가 더 깔끔해지고 나중에 경로를 추가하거나 수정하기 쉬워집니다. 또한, 이 경로 목록은 SecurityConfig.java의 SwaggerPatterns와 관련이 있어 보입니다. 일관성을 유지하고 유지보수성을 높이기 위해 한 곳에서 경로 정의를 중앙 관리하는 것을 권장합니다.
| if (path.startsWith("/v3/api-docs") | |
| || path.startsWith("/swagger-ui") | |
| || path.startsWith("/swagger-ui.html") | |
| || path.startsWith("/swagger-resources") | |
| || path.startsWith("/webjars")) { | |
| response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); | |
| response.setHeader( | |
| "WWW-Authenticate", | |
| "Basic realm=\"Swagger API\"" | |
| ); | |
| return; | |
| } | |
| String[] swaggerPaths = { | |
| "/v3/api-docs", | |
| "/swagger-ui", | |
| "/swagger-ui.html", | |
| "/swagger-resources", | |
| "/webjars" | |
| }; | |
| for (String swaggerPath : swaggerPaths) { | |
| if (path.startsWith(swaggerPath)) { | |
| response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); | |
| response.setHeader( | |
| "WWW-Authenticate", | |
| "Basic realm=\"Swagger API\"" | |
| ); | |
| return; | |
| } | |
| } |
#️⃣ 연관된 이슈
#️⃣ 작업 내용
#️⃣ 테스트 결과
#️⃣ 변경 사항 체크리스트
#️⃣ 스크린샷 (선택)
#️⃣ 리뷰 요구사항 (선택)
📎 참고 자료 (선택)