fix: Swagger UI/API 문서에 Basic Auth 인증 추가 - #472
Merged
Merged
Conversation
📊 테스트 커버리지 리포트
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ Issue Number
📝 요약(Summary)
/swagger-ui.html,/swagger-ui/**)와 API 문서(/v3/api-docs/**,/swagger-resources/**)가 dev/prod 환경에서도 인증 없이 전면 공개되어 있던 문제를 수정했습니다.SecurityConfig,JwtAuthenticationFilter두 화이트리스트 모두 무인증(permitAll)이었고, 9000번 포트가 전체 인터페이스에 바인딩되어 있어 API 전체 스펙(actuator 엔드포인트 포함)이 외부에 노출될 수 있는 상태였습니다.SecurityConfig에 swagger 경로 전용SecurityFilterChain(swaggerFilterChain,@Order(1))을 추가하고@Profile({"dev", "prod"})로 두 환경에서만 활성화했습니다. 인메모리UserDetailsService(swaggerUserDetailsService)가swagger.username/swagger.password프로퍼티로 Basic Auth 계정을 구성합니다. 기존 메인 필터체인은@Order(2)로 명시했습니다.application-dev.yml/application-prod.yml에swagger.username/swagger.password를 각각${SWAGGER_USER}/${SWAGGER_PASSWORD}환경변수로 추가하고,cd.yml의 dev/proddocker run에 해당 환경변수를SWAGGER_DEV_*/SWAGGER_PROD_*GitHub Secrets로부터 주입하도록 했습니다(계정 값은 dev/prod 별도로 이미 등록해뒀습니다).💬 공유사항 to 리뷰어
JwtAuthenticationFilter.AUTH_WHITELIST와SecurityConfig.RESOURCE_LIST는 건드리지 않았습니다. dev/prod에서는 새swaggerFilterChain이 우선순위(@Order(1))로 swagger 요청을 먼저 가로채 기존 JWT 필터를 아예 타지 않고, local에서는 기존 로직 그대로 통과하므로 두 화이트리스트를 수정할 필요가 없었습니다. 다만.claude/rules/auth.md에 "새 public 엔드포인트 추가 시 두 곳을 함께 수정"이라는 관례가 적혀 있는데, 이번엔 반대로 "제거"라 해당 관례가 적용되는 케이스인지 리뷰 시 한번 봐주시면 좋겠습니다.✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.