actuator 메트릭 관리자 인증 경로 보강 - #811
Merged
Hidden character warning
The head ref may contain hidden characters: "20260727_#806_actuator_\uba54\ud2b8\ub9ad_\uad00\ub9ac\uc790_\uc778\uc99d_\uacbd\ub85c_\ubcf4\uac15"
Merged
Conversation
…ator/ 경로도 처리하도록 확장(#806)
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Walkthrough관리자 인증 필터가 ChangesActuator 인증 및 관측성
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
문제
PR #807 배포 후 운영에서 실측한 결과,
/actuator/prometheus와/actuator/metrics가 관리자 토큰으로도 403이 나서 아무도 접근할 수 없는 상태였습니다.원인
두 인증 필터 모두
/actuator/*를 처리하지 않습니다.TokenAuthenticationFilter:59—uri.startsWith("/api/")인 경우에만 Bearer 토큰을 읽음AdminJwtAuthenticationFilter—/admin,/api/admin, Swagger 경로만 처리그 결과
/actuator/*요청은 인증 주체가 설정되지 않은 채hasRole("ADMIN")검사에 도달하고, 익명 사용자로 판정돼 403이 됩니다.PR #807이 메트릭 엔드포인트를
ADMIN_PATHS로 옮기면서 드러난 문제입니다. 이 상태로는 PR #807의 목적인 "개선 효과를 메트릭으로 측정"이 불가능합니다.수정
AdminJwtAuthenticationFilter가/actuator/경로도 처리하도록 확장했습니다. 이 필터는 이미 Swagger(/docs/**,/v3/api-docs/**)라는 비-/api경로를 같은 방식으로 다루고 있어, 그 패턴을 그대로 따랐습니다./actuator/health는 필터의 화이트리스트 체크가 프리픽스 체크 뒤에 있어 여전히 미인증 200입니다. Dockerfile HEALTHCHECK와 Traefik 블루/그린 전환에 영향이 없습니다.검증
ConfigBindingTest(실기동 통합 테스트,RANDOM_PORT) 6개 통과:/actuator/prometheus→ 200이고 본문에hikaricp_,jvm_지표 포함/actuator/prometheus→ 접근 거부/actuator/health→ 200관리자 자격증명은
admin.yml에서@Value로 주입받아 씁니다. 테스트 코드에 하드코딩하지 않았습니다.테스트 컨텍스트에
@AutoConfigureObservability(tracing = false)를 추가했습니다.@SpringBootTest가 기본으로 메트릭 export를 끄기 때문이며, 이를 되돌리는 Spring Boot 공식 수단입니다. 프로덕션 설정은 변경하지 않았습니다.보안 리뷰 결과
/actuator/health미인증 200 유지 — 코드 추적 + 통합 테스트 양쪽 확인filterChain.doFilter()탈출 경로 4개 전수 추적 — 인증 우회 없음TokenAuthenticationFilter가 비-/api/경로에 인증 주체를 세우지 않으므로ROLE_ADMIN검사에서 401)남은 후속 작업
ROLE_ADMIN검사가 나중에 제거되면 잡아낼 테스트가 없습니다.Summary by CodeRabbit
/actuator/엔드포인트에 관리자 인증을 적용했습니다.