Conversation
There was a problem hiding this comment.
Code Review
This pull request restricts access to the /actuator/** endpoints by requiring the ADMIN role instead of permitting all requests. The reviewer recommends using hasAnyRole("ADMIN", "MONITORING") to ensure external monitoring systems can still access necessary endpoints without requiring full administrative privileges.
| .requestMatchers("/admin/**", "/api/admin/**", "/api/v2/admin/**").hasRole("ADMIN") | ||
| .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/api-docs/**", "/swagger-ui.html").permitAll() | ||
| .requestMatchers("/actuator/**").permitAll() | ||
| .requestMatchers("/actuator/**").hasRole("ADMIN") |
There was a problem hiding this comment.
현재 /actuator/** 경로에 대해 ADMIN 권한을 요구하도록 변경하여 민감한 엔드포인트(예: /actuator/env, /actuator/heapdump 등)를 보호하는 것은 좋은 보안 조치입니다.
다만, Prometheus 등 외부 모니터링 시스템이 /actuator/prometheus나 /actuator/info와 같은 엔드포인트를 주기적으로 수집(Scraping)해야 하는 경우, 모니터링 시스템에 과도한 권한(ADMIN)을 부여해야 하거나 수집이 차단될 수 있습니다.
권장 사항:
최소 권한 원칙(Principle of Least Privilege)을 준수하기 위해, 모니터링 전용 역할(예: MONITORING)을 추가로 정의하고 hasAnyRole을 사용하여 권한을 부여하는 것을 고려해 보세요.
(참고: /actuator/health는 healthSecurityFilterChain에서 이미 permitAll()로 설정되어 있으므로 이 변경의 영향을 받지 않습니다.)
| .requestMatchers("/actuator/**").hasRole("ADMIN") | |
| .requestMatchers("/actuator/**").hasAnyRole("ADMIN", "MONITORING") |
변경사항
관련 이슈
Closes #
추가 컨텍스트