[Fix] /conversations api를 호출할 때 accesstoken을 전달하도록 보완#159
Conversation
📝 WalkthroughWalkthroughHTTP 요청의 Authorization 헤더에서 추출한 accessToken을 ConversationController에서 ChatService를 통해 ProovyAiRequest DTO로 전달하는 토큰 스레딩 로직을 구현합니다. Bearer 토큰 파싱 헬퍼 메서드를 추가하고 메서드 시그니처를 업데이트합니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@src/main/java/com/proovy/domain/conversation/dto/request/ProovyAiRequest.java`:
- Around line 47-49: The ProovyAiRequest DTO currently includes authToken which
will be printed by Lombok-generated toString() when ChatServiceImpl logs the
request; exclude this sensitive field by either adding Lombok's
`@ToString.Exclude` to the authToken field or switch the class to
`@ToString`(onlyExplicitlyIncluded = true) and explicitly include non-sensitive
fields, or implement a custom toString() that omits authToken; update the
ProovyAiRequest class (field authToken and class-level Lombok annotations) so
logs no longer expose the token while leaving other fields printable.
🧹 Nitpick comments (1)
src/main/java/com/proovy/domain/conversation/controller/ConversationController.java (1)
88-96:@AuthenticationPrincipal이 이미 인증을 처리하므로, 토큰이 없을 때의 동작을 확인하세요.Spring Security 필터 체인이 이미
Authorization헤더를 검증하여UserPrincipal을 설정하므로, 이 엔드포인트에 도달했다면 토큰이 존재할 가능성이 높습니다. 그럼에도required = false로 설정되어 있고,extractBearerToken이null을 반환할 수 있어 AI 서버에authToken: null이 전달될 수 있습니다.AI 서버에서
authToken이 필수라면null체크 후 적절한 에러를 반환하는 것이 안전합니다.
| // 선택: authToken - Spring 백엔드 인증 토큰 (크레딧 API 호출용) | ||
| @JsonProperty("authToken") | ||
| private String authToken; |
There was a problem hiding this comment.
authToken이 로그에 노출될 수 있는 보안 위험
ChatServiceImpl Line 286에서 log.debug("Request payload: {}", request)로 이 객체를 로깅하고 있습니다. Lombok @Getter가 있으므로 기본 toString()에 authToken 값이 포함되어 로그에 민감한 토큰이 노출될 수 있습니다.
@ToString.Exclude를 추가하거나, 클래스 레벨에서 @ToString을 커스텀하여 authToken을 제외하세요.
🛡️ 수정 제안
+import lombok.ToString;
+
`@Getter`
`@Builder`
+@ToString
public class ProovyAiRequest {
// ... existing fields ...
// 선택: authToken - Spring 백엔드 인증 토큰 (크레딧 API 호출용)
`@JsonProperty`("authToken")
+ `@ToString.Exclude`
private String authToken;
}🤖 Prompt for AI Agents
In
`@src/main/java/com/proovy/domain/conversation/dto/request/ProovyAiRequest.java`
around lines 47 - 49, The ProovyAiRequest DTO currently includes authToken which
will be printed by Lombok-generated toString() when ChatServiceImpl logs the
request; exclude this sensitive field by either adding Lombok's
`@ToString.Exclude` to the authToken field or switch the class to
`@ToString`(onlyExplicitlyIncluded = true) and explicitly include non-sensitive
fields, or implement a custom toString() that omits authToken; update the
ProovyAiRequest class (field authToken and class-level Lombok annotations) so
logs no longer expose the token while leaving other fields printable.
gaeunee2
left a comment
There was a problem hiding this comment.
오류 없는 거 확인했습니다. 머지해주세요!
📌 관련 이슈
🏷️ PR 타입
📝 작업 내용
✅ 체크리스트
📎 기타 참고사항
Summary by CodeRabbit
릴리스 노트
New Features
Improvements