Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Aug 26, 2025

작업 요약

same site session 문제 해결을 위한 쿠키 설정 변경

Issue Link

#288

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능
    • 해당 없음
  • 버그 수정
    • 메뉴 이미지 삭제 요청의 경로 변수 바인딩 문제를 해결하여 삭제가 정상 동작합니다.
    • 주문 항목 조회 시 세션이 없으면 빈 목록을 반환하도록 처리했습니다.
  • 보안
    • CORS 요청에서 자격 증명(쿠키/Authorization) 전송을 비활성화했습니다.
    • CSRF 보호를 활성화하고 쿠키 기반 토큰을 사용하도록 구성했습니다.
    • 세션 정책을 필요 시 생성으로 조정해 인증 흐름의 안정성을 개선했습니다.
  • 스타일
    • 코드 포매팅 정리(동작 영향 없음).

@Jjiggu Jjiggu self-assigned this Aug 26, 2025
@Jjiggu Jjiggu added the refactor 리팩토링 label Aug 26, 2025
@Jjiggu Jjiggu merged commit 27b935d into develop Aug 26, 2025
1 of 2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

관리자 API의 MenuImageController에서 삭제 핸들러의 @PathVariable 이름을 경로 변수와 일치하도록 변경. 사용자 API에서 CORS 자격 증명 허용을 제거. 보안 설정에서 CSRF를 Cookie 기반으로 활성화하고 특정 경로는 제외, 세션 정책을 IF_REQUIRED로 변경. OrderController는 HttpServletRequest로 세션을 조건 확인하도록 수정. 서비스 파일은 포매팅만 변경.

Changes

Cohort / File(s) Change Summary
Admin 메뉴 이미지 삭제 바인딩 정정
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/controller/MenuImageController.java
deleteMenuImage의 파라미터명을 idmenuImageId로 변경하여 @DeleteMapping("/{menuImageId}") 경로 변수와 일치시킴. 서비스 호출 인자도 동일하게 수정.
User API 보안 설정(CORS/CSRF/세션)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/CorsConfig.java, nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java
CORS에서 setAllowCredentials(true) 제거. SecurityConfig에서 CSRF를 CookieCsrfTokenRepository로 활성화하고 /api/**, /login/**, /oauth2/**, /swagger-ui/**, /v3/api-docs/**, /orders/**는 CSRF 검사 제외. 세션 정책을 STATELESSIF_REQUIRED로 변경.
주문 조회 세션 처리 및 포매팅
nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/controller/OrderController.java, nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/service/OrderService.java
OrderController의 getOrderItemsHttpSession 인자 대신 HttpServletRequest에서 getSession(false)로 세션 존재 시에만 사용, 없으면 빈 리스트 반환. OrderService는 공백 줄 제거(포매팅).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant OC as OrderController
  participant S as OrderService

  C->>OC: GET /orders/{storeId}/{tableId}/items
  OC->>OC: request.getSession(false)
  alt 세션 없음
    OC-->>C: 200 OK ([] 빈 리스트)
  else 세션 있음
    OC->>S: getOrderItems(storeId, tableId, sessionId)
    S-->>OC: List<OrderItemDTO>
    OC-->>C: 200 OK (목록)
  end
Loading
sequenceDiagram
  autonumber
  participant U as User Agent
  participant SEC as SecurityFilterChain
  participant APP as Application

  U->>SEC: 요청 (예: GET /orders/...)
  rect rgba(200,230,255,0.25)
    note over SEC: CSRF 처리 (CookieCsrfTokenRepository)
    alt 경로가 CSRF 제외(/api/**, /login/**, /oauth2/**, /swagger-ui/**, /v3/api-docs/**, /orders/**)
      SEC->>APP: 요청 전달(검사 생략)
    else 일반 경로
      SEC->>SEC: CSRF 토큰 확인(쿠키/헤더)
      SEC->>APP: 유효 시 요청 전달
      SEC-->>U: 403 (유효하지 않음) 실패 시
    end
  end
  note over SEC,APP: 세션 정책 IF_REQUIRED (필요 시 세션 생성/사용)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • HyemIin

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9c65f6f and 57c1e66.

📒 Files selected for processing (5)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/controller/MenuImageController.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/CorsConfig.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java (3 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/controller/OrderController.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/service/OrderService.java (0 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#288-sameSite-session

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

Labels

refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants