Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Jul 24, 2025

로그인 없이 랭킹 조회 가능하도록 get 요청으로 들어오는 하단 경로를 시큐리티에서 열어줌
하지만 로그인한 유저의 경우, 유저의 정보를 가져와서 본인 랭킹을 확인해야하므로 필터 단계는 검증하도록 설정
필터는 거치고, 시큐리티는 넘어가게
/api/rankings/me/around -> 이 경로는 인증이 필요함 (본인 랭킹 조회용)

//랭킹 조회
.requestMatchers(HttpMethod.GET, "/api/rankings/me/around").authenticated()
.requestMatchers(HttpMethod.GET,
	"/api/rankings/*/around",
        "/api/rankings/weekly",
	"/api/rankings/last-week",
	"/api/rankings/all-time").permitAll()

코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

  • 신규 기능
    • 일부 랭킹 조회 API(주간, 지난주, 전체, 특정 유저 주변 랭킹)에 비로그인 상태에서도 접근할 수 있도록 변경되었습니다.
  • 버그 수정
    • 인증이 필요한 랭킹 API(/api/rankings/me/around)는 로그인한 사용자만 접근할 수 있도록 조정되었습니다.

@minjee2758 minjee2758 self-assigned this Jul 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 24, 2025

Walkthrough

보안 설정이 변경되어 문제 및 랭킹 관련 API 엔드포인트의 접근 제어 규칙이 수정되었습니다. /api/problems/**에 대한 인증 요구가 제거되었고, 일부 랭킹 엔드포인트는 인증 없이 접근할 수 있도록 허용되었습니다. 기타 엔드포인트의 권한 규칙은 기존과 동일하게 유지됩니다.

Changes

파일/경로 변경 요약
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java 문제 및 랭킹 관련 API 엔드포인트의 접근 제어 규칙 수정, 인증 요구 조건 변경

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant SecurityConfig
    participant API

    Client->>SecurityConfig: GET /api/rankings/weekly
    SecurityConfig-->>API: 인증 없이 요청 허용

    Client->>SecurityConfig: GET /api/rankings/me/around
    SecurityConfig-->>API: 인증 필요, 인증 검사

    Client->>SecurityConfig: GET /api/problems/123
    SecurityConfig-->>API: 인증 없이 요청 허용

    Client->>SecurityConfig: GET /api/admin/...
    SecurityConfig-->>API: ADMIN 권한 필요
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • NCookies
  • pokerbearkr
  • chat26666

Poem

토끼가 깡총, 보안 길을 따라
랭킹도 문제도 문을 활짝 열었네
인증은 꼭 필요한 곳에만
규칙은 깔끔, 걱정은 안녕
개발자여, 안심하고 hop hop!
🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5060b18 and 27f6666.

📒 Files selected for processing (1)
  • src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: NCookies
PR: ezcode-my/backend#17
File: src/main/java/org/ezcode/codetest/presentation/problemmanagement/ProblemAdminController.java:25-25
Timestamp: 2025-06-02T06:57:37.929Z
Learning: 이 프로젝트에서는 아직 Spring Security가 적용되지 않아서 @PreAuthorize 어노테이션이 주석 처리되어 있음. Spring Security 도입 전까지는 권한 검증 어노테이션들이 비활성화 상태임.
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java (1)

Learnt from: NCookies
PR: #17
File: src/main/java/org/ezcode/codetest/presentation/problemmanagement/ProblemAdminController.java:25-25
Timestamp: 2025-06-02T06:57:37.929Z
Learning: 이 프로젝트에서는 아직 Spring Security가 적용되지 않아서 @PreAuthorize 어노테이션이 주석 처리되어 있음. Spring Security 도입 전까지는 권한 검증 어노테이션들이 비활성화 상태임.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java (1)

87-94: 랭킹 API 경로 인증 설정 확인 및 승인

  • "/api/rankings/me/around"은 인증이 필요하도록 더 구체적인 규칙으로 먼저 정의되어 의도대로 동작합니다.
  • "/api/rankings/*/around" 패턴은 /api/rankings/{userId}/around (예: 다른 사용자 랭킹 조회)만 매칭하며 인증 없이 접근 가능합니다.
  • /api/rankings/weekly, /api/rankings/last-week, /api/rankings/all-time 엔드포인트도 permitAll 설정이 맞습니다.
  • 실행한 스크립트 결과, 컨트롤러에 정의된 엔드포인트들과 패턴 매칭이 모두 일치함을 확인했습니다.
✨ 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/security-path-ranking

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

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

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @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.

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

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.

@minjee2758 minjee2758 merged commit 1ce68d8 into dev Jul 24, 2025
2 checks passed
@minjee2758 minjee2758 deleted the refactor/security-path-ranking branch July 24, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants