Skip to content

Conversation

@Yujin1219
Copy link
Member

@Yujin1219 Yujin1219 commented Dec 12, 2025

#️⃣ 연관된 이슈

📝 작업 내용

  • 여행 계획 API 인증 구조(JWT) 원복

📌 공유 사항

✅ 체크리스트

  • Reviewer에 팀원들을 선택 했나요?
  • Assignees에 본인을 선택 했나요?
  • Merge 하려는 브랜치가 올바르게 설정되어 있나요?
  • 컨벤션을 지키고 있나요?
  • 로컬에서 실행했을 때 에러가 발생하지 않나요?
  • 불필요한 주석이 제거되었나요?
  • 코드 스타일이 일관적인가요?

스크린샷 (선택)

💬 리뷰 요구사항 (선택)

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요? or 변경 사항 등

Summary by CodeRabbit

릴리스 노트

  • 보안 개선
    • FastAPI 통합을 통한 여행 계획 생성 시 인증 요구 사항이 강화되었습니다.
    • 여행 계획 생성 엔드포인트가 이제 로그인된 사용자만 접근할 수 있도록 보호됩니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@Yujin1219 Yujin1219 self-assigned this Dec 12, 2025
@Yujin1219 Yujin1219 added the 🐛 fix 버그 수정 label Dec 12, 2025
@Yujin1219 Yujin1219 linked an issue Dec 12, 2025 that may be closed by this pull request
@Yujin1219 Yujin1219 merged commit 50d26ee into develop Dec 12, 2025
2 checks passed
@Yujin1219 Yujin1219 deleted the fix/#24 branch December 12, 2025 09:11
@coderabbitai
Copy link

coderabbitai bot commented Dec 12, 2025

Walkthrough

FastAPI 통합 엔드포인트에 대한 인증 요구사항이 변경되었습니다. TripPlanController에서 createTripPlanFromFastAPI 메서드의 인증 처리가 허용적 방식에서 필수적 방식으로 전환되었으며, SecurityConfig에서 해당 경로의 공개 접근 권한이 제거되었습니다.

Changes

Cohort / File(s) Summary
Controller 인증 처리 변경
src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java
createTripPlanFromFastAPI 메서드에서 try-catch 기반의 관용적 인증 처리를 제거하고, 요청에서 직접 userId를 획득하여 무조건적으로 사용하도록 변경. 익명 사용자 처리 경로 및 관련 예외 처리를 제거하고 흐름을 단순화.
보안 설정 화이트리스트 제거
src/main/java/com/example/triptalk/global/config/SecurityConfig.java
/api/trip-plan/from-fastapi 엔드포인트를 permitAll 화이트리스트에서 제거하여, 해당 경로가 공개 접근 가능에서 인증 필수로 변경.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경 사항의 핵심을 명확하게 요약하고 있습니다. JWT 인증 구조 원복이라는 주요 변경 사항을 간결하고 구체적으로 전달합니다.
Description check ✅ Passed PR 설명이 템플릿 구조를 따르고 있으며, 연관 이슈(#24)와 작업 내용(여행 계획 API 인증 구조 JWT 원복)이 기재되어 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#24

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a4b4b3b and 974737f.

📒 Files selected for processing (2)
  • src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java (1 hunks)
  • src/main/java/com/example/triptalk/global/config/SecurityConfig.java (0 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/example/triptalk/global/config/SecurityConfig.java

HttpServletRequest httpRequest
) {

// 인증이 없어도 동작하도록 변경
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

주석이 실제 변경 내용과 모순됩니다.

Line 82의 주석은 "인증이 없어도 동작하도록 변경"이라고 되어 있지만, 실제로는 JWT 인증을 필수로 요구하도록 원복하는 것이 이번 PR의 목적입니다. 이 주석은 완전히 잘못되었으며 향후 개발자에게 혼란을 줄 수 있습니다.

다음 diff를 적용하여 주석을 제거하세요:

-        // 인증이 없어도 동작하도록 변경
         Long userId = authUtil.getUserIdFromRequest(httpRequest);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// 인증이 없어도 동작하도록 변경
Long userId = authUtil.getUserIdFromRequest(httpRequest);
🤖 Prompt for AI Agents
In
src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java
around line 82, the inline comment "// 인증이 없어도 동작하도록 변경" contradicts the PR
which restores mandatory JWT authentication; remove that incorrect comment and
any other misleading notes on or immediately around line 82 so the code and
comments accurately reflect that JWT authentication is required.

Comment on lines +83 to +85
Long userId = authUtil.getUserIdFromRequest(httpRequest);
TripPlanResponse.TripPlanDTO response =
tripPlanService.createTripPlanFromFastAPI(userId, request);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find SecurityConfig file
echo "=== Finding SecurityConfig file ==="
find . -name "*SecurityConfig*" -type f

echo ""
echo "=== Checking for /api/trip-plan/from-fastapi in SecurityConfig ==="
rg -n "from-fastapi" --type=java

echo ""
echo "=== Checking for AuthUtil file ==="
find . -name "*AuthUtil*" -type f

Repository: TripTalk/BE_SpringBoot

Length of output: 466


🏁 Script executed:

#!/bin/bash
echo "=== Reading SecurityConfig.java ==="
cat -n ./src/main/java/com/example/triptalk/global/config/SecurityConfig.java

echo ""
echo "=== Reading AuthUtil.java ==="
cat -n ./src/main/java/com/example/triptalk/global/security/AuthUtil.java

echo ""
echo "=== Reading TripPlanController around lines 60-90 ==="
sed -n '55,95p' -n ./src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java

Repository: TripTalk/BE_SpringBoot

Length of output: 7617


코드 주석과 실제 구현이 불일치합니다.

코드의 81번 줄 주석("인증이 없어도 동작하도록 변경")은 실제 구현과 맞지 않습니다. SecurityConfig에서 /api/trip-plan/from-fastapi는 permitAll() 목록에 없으며, 57번 줄의 .anyRequest().authenticated()에 의해 모든 요청이 인증을 요구합니다. 또한 AuthUtil.getUserIdFromRequest()는 토큰이 없거나 유효하지 않을 때 _UNAUTHORIZED 예외를 발생시키므로 인증이 올바르게 강제됩니다. 주석을 제거하거나 실제 구현과 일치하도록 수정하세요.

🤖 Prompt for AI Agents
In
src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java
around lines 83 to 85, the inline comment stating "인증이 없어도 동작하도록 변경" conflicts
with the actual behavior (SecurityConfig requires authentication and AuthUtil
throws on missing/invalid tokens); remove or replace that comment so it
correctly states that this endpoint requires authentication, and optionally
mention that AuthUtil.getUserIdFromRequest(...) will throw if the token is
absent/invalid so callers must be authenticated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 fix 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Fix: fastapi 연동 문제 해결

2 participants