-
Notifications
You must be signed in to change notification settings - Fork 3
[feat] 부하테스트 진행 #93
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
[feat] 부하테스트 진행 #93
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package com.spring.monew.auth.config; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사용되지 않는 로깅 어노테이션 제거 필요
다음과 같이 제거하는 것을 권장합니다: package com.spring.monew.auth.config;
import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;-@Slf4j
@RequiredArgsConstructor
@Configuration
@EnableWebSecurityAlso applies to: 17-17 🤖 Prompt for AI Agents |
||
| import org.springframework.beans.factory.annotation.Value; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
@@ -14,6 +15,7 @@ | |
| import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; | ||
| import com.spring.monew.common.filter.RequestIdFilter; | ||
|
|
||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| @Configuration | ||
| @EnableWebSecurity | ||
|
|
@@ -22,20 +24,26 @@ public class SecurityConfig { | |
| private final HeaderAuthFilter headerAuthFilter; | ||
| private final RequestIdFilter requestIdFilter; | ||
|
|
||
| @Value("${monitoring.prometheus.allow-ip}") | ||
| private String prometheusAllowIp; // yml 속성 주입 (기본값은 localhost) | ||
| @Value("${monitoring.prometheus.allow-ip:127.0.0.1}") | ||
| private String prometheusAllowIp; | ||
|
|
||
| @Bean | ||
| public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { | ||
| http | ||
| .csrf(AbstractHttpConfigurer::disable) // CSRF 보안 비활성화 (개발용) | ||
|
|
||
| .csrf(AbstractHttpConfigurer::disable) | ||
| .authorizeHttpRequests(authorize -> authorize | ||
| .requestMatchers("/actuator/prometheus") | ||
| .access((authentication, context) -> { | ||
| String remoteAddr = context.getRequest().getRemoteAddr(); | ||
| boolean equals = remoteAddr.equals(prometheusAllowIp);// Prometheus IP | ||
| return new AuthorizationDecision(equals); | ||
| boolean allowed = | ||
| remoteAddr.equals("127.0.0.1") || | ||
| remoteAddr.equals("0:0:0:0:0:0:0:1") || // IPv6 localhost | ||
| remoteAddr.equals("localhost") || | ||
| remoteAddr.startsWith("172.") || // Docker 내부 네트워크 | ||
| remoteAddr.startsWith("192.168.") || | ||
| remoteAddr.equals(prometheusAllowIp); | ||
|
|
||
| return new AuthorizationDecision(allowed); | ||
|
Comment on lines
+38
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 프로덕션 환경에서 과도하게 허용적인 Prometheus 접근 제어 Prometheus 메트릭 엔드포인트 접근을 IP 기반으로만 제어하고 있으며, Docker 네트워크 전체( 다음 개선사항을 고려해주세요:
// 환경별 설정 예시
@Value("${spring.profiles.active:local}")
private String activeProfile;
// 접근 제어 로직에서
boolean allowed;
if ("prod".equals(activeProfile)) {
// 프로덕션: 특정 IP만 허용
allowed = remoteAddr.equals(prometheusAllowIp);
} else {
// 개발/테스트: 넓은 범위 허용
allowed = remoteAddr.equals("127.0.0.1") ||
remoteAddr.equals("0:0:0:0:0:0:0:1") ||
remoteAddr.startsWith("172.") ||
remoteAddr.startsWith("192.168.") ||
remoteAddr.equals(prometheusAllowIp);
}🤖 Prompt for AI Agents |
||
| }) | ||
| .requestMatchers("/actuator/health", "/actuator/info", | ||
| "/actuator/loggers").permitAll() //Actuator 허용 (원래는 이렇게 하면 안됨) | ||
|
|
@@ -52,7 +60,6 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { | |
| return http.build(); | ||
| } | ||
|
|
||
|
|
||
| @Bean | ||
| public PasswordEncoder passwordEncoder() { | ||
| return new BCryptPasswordEncoder(); | ||
|
|
||
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.
🧩 Analysis chain
환경 변수 설정 확인 필요
네이버 API 자격증명을 환경 변수로 주입하는 방식은 적절합니다. 하지만
docker-compose up실행 전에 해당 환경 변수가 설정되어 있는지 확인이 필요합니다.다음을 확인해주세요:
.env파일 또는 셸 환경에NAVER_CLIENT_ID와NAVER_CLIENT_SECRET이 설정되어 있는지 확인🏁 Script executed:
Length of output: 90
Length of output: 2406
Length of output: 455
.env.example템플릿 파일 추가 필요네이버 API 자격증명(
NAVER_CLIENT_ID,NAVER_CLIENT_SECRET)이 환경 변수로 주입되도록 설정되어 있으나, 프로젝트에.env.example템플릿이 없어 개발자가 어떤 환경 변수를 설정해야 하는지 알 수 없습니다.monew/디렉토리에.env.example파일을 생성하여 필수 환경 변수를 명시해주세요.예시:
개발자는
docker-compose up실행 전에 이 파일을 복사하여.env파일을 만들고 실제 값을 입력해야 합니다.🤖 Prompt for AI Agents