-
Notifications
You must be signed in to change notification settings - Fork 0
[REFACTOR] Log 형식 변경 #162
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
[REFACTOR] Log 형식 변경 #162
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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,134 +5,70 @@ | |||||||||||||||
| import org.aspectj.lang.annotation.Around; | ||||||||||||||||
| import org.aspectj.lang.annotation.Aspect; | ||||||||||||||||
| import org.aspectj.lang.annotation.Pointcut; | ||||||||||||||||
| import org.aspectj.lang.reflect.CodeSignature; | ||||||||||||||||
| import org.aspectj.lang.reflect.MethodSignature; | ||||||||||||||||
| import org.springframework.stereotype.Component; | ||||||||||||||||
| import org.springframework.util.StopWatch; | ||||||||||||||||
|
|
||||||||||||||||
| import java.util.HashMap; | ||||||||||||||||
| import java.util.Map; | ||||||||||||||||
| import java.util.Arrays; | ||||||||||||||||
|
|
||||||||||||||||
| @Component | ||||||||||||||||
| @Aspect | ||||||||||||||||
| @Slf4j | ||||||||||||||||
| public class LogAspect { | ||||||||||||||||
|
|
||||||||||||||||
| private static final String[] SENSITIVE_KEYWORDS = { | ||||||||||||||||
| "password", "pw", "secret", | ||||||||||||||||
| "token", "access", "refresh", | ||||||||||||||||
| "auth", "cred", | ||||||||||||||||
| "key", "pin", "card", | ||||||||||||||||
| "ssn", "social" | ||||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| @Pointcut("execution(* com.loopon..*Controller.*(..))") | ||||||||||||||||
| public void controllerMethods() { | ||||||||||||||||
| @Pointcut("execution(* com.loopon.*Controller.*(..))") | ||||||||||||||||
|
||||||||||||||||
| @Pointcut("execution(* com.loopon.*Controller.*(..))") | |
| @Pointcut("execution(* com.loopon..*Controller.*(..))") |
Copilot
AI
Feb 18, 2026
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.
예외 발생 시 로깅 기능이 완전히 제거되었습니다. 이전 코드에서는 try-catch 블록에서 예외를 캐치하여 logFailure 메서드로 상세한 에러 로그(클래스명, 메서드명, 파라미터, 예외 타입, 메시지, 소요시간)를 남겼습니다.
현재 코드는 finally 블록에서만 로깅하므로, 예외가 발생한 경우와 정상 실행된 경우를 구분할 수 없고, 예외 정보가 로그에 전혀 남지 않습니다.
GlobalExceptionAdvice에서 예외를 로깅하고 있지만, 이는 HTTP 요청 레벨의 예외만 처리하며, Service 계층에서 발생한 예외의 상세 컨텍스트(어떤 파라미터로 호출되었는지 등)를 추적하기 어렵습니다.
예외 발생 시 로그 레벨을 error로, 정상 실행 시 info로 구분하여 로깅하는 것을 권장합니다.
Copilot
AI
Feb 18, 2026
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.
민감한 정보(password, token 등)에 대한 마스킹 처리가 제거되었습니다. 이전 코드에서는 SENSITIVE_KEYWORDS 배열을 사용하여 password, token, secret 등의 민감한 파라미터를 "****"로 마스킹했습니다.
현재 코드는 Arrays.toString(args)를 직접 사용하여 모든 파라미터 값을 그대로 로그에 출력하므로, LoginRequest의 password 필드나 AuthService의 token 파라미터 등이 평문으로 로그에 기록됩니다.
이는 심각한 보안 취약점입니다. 로그 파일이 노출되거나 로그 모니터링 시스템에 접근 가능한 사람이 사용자의 비밀번호나 인증 토큰을 확인할 수 있습니다.
이전의 민감 정보 마스킹 로직을 다시 적용하거나, 파라미터 로깅 자체를 제거하는 것을 고려해야 합니다.
| if (args == null || args.length == 0) return "[]"; | |
| return Arrays.toString(args); | |
| if (args == null || args.length == 0) { | |
| return "[]"; | |
| } | |
| // 민감 정보 노출 방지를 위해 실제 파라미터 값은 로그에 남기지 않는다. | |
| return "[MASKED]"; |
Copilot
AI
Feb 18, 2026
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.
변수명 's'는 의미가 불명확합니다. 이전 코드에서는 'resultStr'을 사용하여 변수의 역할이 명확했습니다.
간단한 로직이지만 'resultString' 또는 'resultStr'과 같이 의미를 명확히 전달하는 이름을 사용하는 것이 좋습니다.
| String s = result.toString(); | |
| return s.length() > 100 ? s.substring(0, 100) + "..." : s; | |
| String resultStr = result.toString(); | |
| return resultStr.length() > 100 ? resultStr.substring(0, 100) + "..." : resultStr; |
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.
GlobalExceptionAdvice에서 AuthorizationException에 대한 핸들러가 제거되었지만, 이 예외는 여전히 코드베이스 전체에서 사용되고 있습니다.
확인된 사용 위치:
AuthorizationException이 발생하면 이제 일반 Exception 핸들러로 처리되어 500 INTERNAL_SERVER_ERROR로 응답됩니다. 이는 의도한 동작이 아닐 가능성이 높습니다.
AuthorizationException 핸들러를 다시 추가하거나, 이 예외를 다른 예외 타입으로 변경하는 작업이 필요합니다.