Skip to content
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

[DDING-000] 파일 타입 폼 응답 presignedUrl 발급 API 인증 허용 추가 #271

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

5uhwann
Copy link
Collaborator

@5uhwann 5uhwann commented Feb 17, 2025

🚀 작업 내용

  • 파일 타입 폼 응답을 위한 presignedUrl 발급 API 인증 허용 설정 추가

🤔 고민했던 내용

💬 리뷰 중점사항

Summary by CodeRabbit

  • New Features
    • 사용자 인증 없이 접근 가능한 파일 업로드 양식 엔드포인트가 추가되었습니다. 이로 인해 관련 기능의 사용 편의성이 개선되었습니다.

@5uhwann 5uhwann added 🎯리팩토링 리팩토링 및 고도화 이슈 D-0 labels Feb 17, 2025
@5uhwann 5uhwann self-assigned this Feb 17, 2025
Copy link

coderabbitai bot commented Feb 17, 2025

Walkthrough

이 PR은 SecurityConfig 클래스의 HTTP 보안 설정을 수정합니다. 구체적으로는 POST 메서드에 대한 요청 매처가 추가되어 /file/upload-url/form-application 엔드포인트에 대한 접근이 모든 사용자에게 허용됩니다. 기존의 /forms/{formId}/applications 엔드포인트 접근 또한 허용됩니다. CORS 설정, CSRF 보호, 세션 관리, JWT 필터 연동 등 다른 보안 설정은 변경되지 않았습니다.

Changes

파일 변경 요약
src/main/java/.../SecurityConfig.java HTTP 보안 설정 수정: POST 요청 매처 추가하여 /file/upload-url/form-application 및 기존 /forms/{formId}/applications 접근 허용

Sequence Diagram(s)

sequenceDiagram
    participant 클라이언트 as Client
    participant 보안필터 as SecurityFilter
    클라이언트->>보안필터: POST /file/upload-url/form-application 요청
    보안필터->>보안필터: 요청 매처 규칙 검사
    보안필터-->>클라이언트: 접근 허용 결정
Loading

Possibly related PRs

Suggested labels

🚨긴급

Suggested reviewers

  • wonjunYou
  • KoSeonJe
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

  • 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.

@5uhwann 5uhwann merged commit 9f9ea7d into develop Feb 17, 2025
1 of 2 checks passed
@5uhwann 5uhwann deleted the refactor/DDING-000 branch February 17, 2025 05:35
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: 0

🧹 Nitpick comments (1)
src/main/java/ddingdong/ddingdongBE/common/config/SecurityConfig.java (1)

51-52:

❓ Verification inconclusive

GET 메서드로 presignedUrl을 발급하는 것이 적절한지 검토가 필요합니다.

일반적으로 presignedUrl 발급은 POST 메서드를 사용하는 것이 더 적절할 수 있습니다. GET 메서드는 멱등성을 가지며 캐시될 수 있기 때문입니다.

다음 사항들을 고려해 주시기 바랍니다:

  1. POST 메서드로 변경하여 멱등성 문제 해결
  2. Rate limiting 적용 검토
  3. 요청 본문에 파일 메타데이터 포함 가능

아래 스크립트로 현재 구현을 확인해 보시겠습니까?


🏁 Script executed:

#!/bin/bash
# Description: Check the controller implementation for the file upload URL endpoint

rg -A 10 "upload-url/form-application"

Length of output: 1792


보안 및 HTTP 메서드 선택 검토 필요

현재 presigned URL 엔드포인트가 GET 메서드로 구현되어 있습니다. 이 방식은 캐싱이나 멱등성 특성 때문에 의도치 않은 보안 취약점을 유발할 수 있으므로 아래 사항들을 재검토해 주세요.

  • GET → POST 전환 검토: presigned URL 발급과 같이 민감한 작업은 POST 메서드를 사용하는 것이 바람직합니다.
  • 보안 강화: 현재 엔드포인트가 모두 허용 정책(.permitAll)으로 설정되어 있으므로, 추가적인 인증 또는 인가 로직 도입을 고려해 주세요.
  • Rate Limiting 적용: 악의적 요청으로부터 시스템을 보호하기 위한 rate limiting 기능 도입을 검토해 주세요.
  • 요청 데이터 개선: 파일 메타데이터와 같은 추가 정보를 요청 본문에 포함시켜, 보안 및 데이터 검증을 강화할 수 있는지 확인해 주세요.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6a4584 and 8ae643d.

📒 Files selected for processing (1)
  • src/main/java/ddingdong/ddingdongBE/common/config/SecurityConfig.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and analyze
🔇 Additional comments (1)
src/main/java/ddingdong/ddingdongBE/common/config/SecurityConfig.java (1)

51-52: 인증되지 않은 사용자의 접근을 허용하기 전에 보안 위험을 검토해 주세요.

파일 업로드 URL을 public하게 노출하면 다음과 같은 보안 위험이 있을 수 있습니다:

  1. 무분별한 파일 업로드로 인한 스토리지 리소스 남용
  2. 악성 파일 업로드 시도

다음과 같은 보안 조치를 고려해 주시기 바랍니다:

  1. 업로드 가능한 파일 크기 제한
  2. 허용된 파일 타입 검증
  3. 업로드 요청 횟수 제한

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-0 🎯리팩토링 리팩토링 및 고도화 이슈
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant