Skip to content

fix: cors 이슈 픽스#200

Merged
LeeHanEum merged 1 commit intodevelopfrom
fix/199-cors-fix
Feb 7, 2025
Merged

fix: cors 이슈 픽스#200
LeeHanEum merged 1 commit intodevelopfrom
fix/199-cors-fix

Conversation

@LeeHanEum
Copy link
Copy Markdown
Member

@LeeHanEum LeeHanEum commented Feb 7, 2025

Summary

CORS 이슈를 픽스 합니다.

Tasks

  • cors 이슈 픽스

@LeeHanEum LeeHanEum added the 🐞bug Something isn't working label Feb 7, 2025
@LeeHanEum LeeHanEum requested a review from a team February 7, 2025 11:46
@LeeHanEum LeeHanEum self-assigned this Feb 7, 2025
Copilot AI review requested due to automatic review settings February 7, 2025 11:46
@LeeHanEum LeeHanEum linked an issue Feb 7, 2025 that may be closed by this pull request
1 task
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 7, 2025

Walkthrough

이번 PR은 SecurityConfig 클래스의 corsConfigurationSource 메서드를 수정하여 CORS 구성의 허용 출처 목록을 업데이트합니다. 기존에 허용되던 "https://aics-auth.ummdev.com"에 더해 새로운 출처 "https://aics-client-dev.vercel.app/"가 추가되어, 두 출처 모두 CORS 요청에 대해 허용되도록 변경되었습니다.

Changes

파일명 변경 요약
aics-common/.../SecurityConfig.java corsConfigurationSource 메서드에서 CORS 허용 출처 목록 업데이트: 기존 출처 유지, 새로운 출처 추가

Possibly related PRs

Suggested reviewers

  • minjo-on
✨ 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.

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 7, 2025

Test Coverage Report

Overall Project 95.74% 🍏

There is no coverage information present for the Files changed

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #200   +/-   ##
==========================================
  Coverage      92.99%   92.99%           
  Complexity       129      129           
==========================================
  Files             48       48           
  Lines            371      371           
  Branches           4        4           
==========================================
  Hits             345      345           
  Misses            21       21           
  Partials           5        5           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f806df4...6e75a7b. Read the comment docs.

Copy link
Copy Markdown
Contributor

@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: 1

🔭 Outside diff range comments (1)
aics-common/src/main/java/kgu/developers/common/config/SecurityConfig.java (1)

91-93: CORS 보안 설정 강화가 필요합니다.

현재 모든 헤더와 메소드를 허용하는 것("*")은 보안상 위험할 수 있습니다. 필요한 헤더와 메소드만 명시적으로 허용하는 것이 좋습니다.

다음과 같이 수정하는 것을 제안드립니다:

-			config.setAllowedHeaders(Collections.singletonList("*"));
-			config.setAllowedMethods(Collections.singletonList("*"));
+			config.setAllowedHeaders(Arrays.asList(
+				"Authorization",
+				"Content-Type",
+				"Accept"
+			));
+			config.setAllowedMethods(Arrays.asList(
+				"GET",
+				"POST",
+				"PUT",
+				"DELETE",
+				"OPTIONS"
+			));
🧹 Nitpick comments (1)
aics-common/src/main/java/kgu/developers/common/config/SecurityConfig.java (1)

88-106: 환경별 CORS 설정 분리를 고려해보세요.

개발, 스테이징, 프로덕션 환경에 따라 허용되는 오리진이 다를 수 있습니다. 환경 변수나 프로필을 통해 이를 관리하는 것이 좋습니다.

예시:

@Value("${cors.allowed-origins}")
private String[] allowedOrigins;

CorsConfigurationSource corsConfigurationSource() {
    return request -> {
        CorsConfiguration config = new CorsConfiguration();
        // ... other configurations ...
        config.setAllowedOriginPatterns(Arrays.asList(allowedOrigins));
        return config;
    };
}

application.yml:

cors:
  allowed-origins:
    - http://localhost:3000
    - https://aics-auth.ummdev.com
    - https://aics-client-dev.vercel.app
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f806df4 and 6e75a7b.

📒 Files selected for processing (1)
  • aics-common/src/main/java/kgu/developers/common/config/SecurityConfig.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-docker-image

Comment on lines +100 to +101
"https://aics-auth.ummdev.com",
"https://aics-client-dev.vercel.app/"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

URL 형식의 일관성 개선이 필요합니다.

새로 추가된 URL에 trailing slash가 포함되어 있어 기존 URL들과 형식이 일치하지 않습니다.

다음과 같이 수정하는 것을 제안드립니다:

 				"https://aics-auth.ummdev.com",
-				"https://aics-client-dev.vercel.app/"
+				"https://aics-client-dev.vercel.app"
📝 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
"https://aics-auth.ummdev.com",
"https://aics-client-dev.vercel.app/"
"https://aics-auth.ummdev.com",
"https://aics-client-dev.vercel.app"

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

Labels

🐞bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CORS 이슈 픽스

3 participants