Skip to content

[fix] FE 보안 취약점 패치 및 보안 설정 강화 - #125

Merged
You-Hyuk merged 11 commits into
mainfrom
fix/#124-frontend-security-hardening
Jul 6, 2026
Merged

You-Hyuk merged 11 commits into
mainfrom
fix/#124-frontend-security-hardening

Conversation

@You-Hyuk

@You-Hyuk You-Hyuk commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

관련 이슈

Closes #124


변경 개요

FE 보안 리뷰를 통해 발견된 취약점을 패치하고, 기본 보안 설정을 강화합니다.
패키지 CVE 3건 해결, Open Redirect 방어, CSP/SRI/HTTP 보안 헤더 적용, 탭 간 로그아웃 동기화, Error Boundary, CI 자동화까지 총 9개 항목을 반영합니다.

변경사항

파일 변경 내용
package-lock.json npm audit fix — axios Prototype Pollution, react-router Open Redirect CVE, vite Path Traversal 패치
src/stores/loginModalStore.js Open Redirect 방어 — new URL() 파싱 후 동일 origin 검증, pathname+search만 저장
src/pages/AuthCallbackPage.jsx, SignupPage.jsx redirectUri startsWith('/') 유효성 검증 추가 (use 시점 방어)
src/components/artist/ArtistCard.jsx 외 3개 페이지 window.location.hrefpathname + search 전달로 수정 (pass 시점 방어)
index.html CSP 메타태그 + Pretendard CDN SRI 해시 추가
.gitignore .env, .env.* 패턴 추가
vercel.json 보안 헤더 5종 추가 (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, HSTS, Permissions-Policy)
src/App.jsx storage 이벤트로 탭 간 로그아웃 동기화 — 다른 탭 로그아웃 시 SESSION_HINT 제거 감지 후 상태 초기화
src/components/ui/ErrorBoundary.jsx React Error Boundary 컴포넌트 신규 추가
src/main.jsx 앱 루트에 ErrorBoundary 래핑
.github/workflows/audit.yml CI npm audit 워크플로 추가 — package 파일 변경 PR 시 HIGH 이상 취약점 자동 차단
vite.config.js 프로덕션 빌드 소스맵 명시적 비활성화

주요 구현 내용

Open Redirect 3중 방어

  • Pass 시점: 호출부에서 pathname + search만 전달
  • Store 시점: loginModalStore.open()에서 new URL() 파싱 → 동일 origin 검증 → pathname+search만 저장
  • Use 시점: 리다이렉트 직전 startsWith('/') 검증 후 미통과 시 홈으로 fallback

테스트

  • 로컬 실행 확인
  • npm run build 성공 확인 (소스맵 미생성 확인)
  • 소셜 로그인 후 redirectUri 정상 동작 확인 필요 (배포 후)
  • 보안 헤더 적용 확인 필요 (curl -I https://comingg.com 또는 securityheaders.com)

코드 리뷰

변경사항 요약

보안 강화 목적의 변경. 기존 동작에 영향을 주는 코드 수정(Open Redirect 방어, 탭 간 로그아웃)과 신규 추가(ErrorBoundary, CI 워크플로, Vercel 헤더, sourcemap 비활성화)로 구성.


🔵 suggestion

  • src/components/ui/ErrorBoundary.jsx: 에러 화면에 인라인 스타일 사용 — 프로젝트의 CSS Modules 컨벤션과 불일치. 추후 ErrorBoundary.module.css 분리 가능.
  • .github/workflows/audit.yml: package.json/package-lock.json 변경 시에만 트리거됨 — 기존 의존성에 신규 CVE가 공개된 경우 자동 감지 안 됨. 필요 시 schedule: cron 추가로 주기적 스캔 가능.

You-Hyuk and others added 9 commits July 6, 2026 14:28
- npm audit fix 실행
- axios, react-router-dom, vite HIGH/MODERATE CVE 일괄 패치
- react-router Open Redirect CVE, axios Prototype Pollution 포함

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- loginModalStore.open(): 전달된 URL을 pathname+search로 정규화, 외부 origin 차단
- ArtistCard·ConcertDetailPage·CalendarPage·ArtistDetailPage:
  openLoginModal 호출 시 window.location.href → pathname+search로 교체
- AuthCallbackPage·SignupPage: localStorage에서 꺼낸 redirectUri가
  /로 시작하지 않으면 HOME으로 fallback (protocol-relative URL 차단)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Content-Security-Policy 메타태그 추가
  - script-src 'self': 인라인 스크립트·외부 스크립트 차단
  - frame-ancestors 'none': Clickjacking 방어
  - connect-src 'self': 승인되지 않은 외부 API 호출 차단
  - style/font: jsdelivr.net CDN만 허용
- Pretendard CDN link에 SRI integrity 해시 추가 (sha384)
  CDN 오염 시 변조된 CSS 로딩 차단

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .env, .env.* 패턴 추가 (단, .env.example 제외)
- 기존 *.local만으로는 .env 자체가 커밋될 수 있어 보완

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@You-Hyuk You-Hyuk added Bug 🐛 버그 수정 Feat ✨ 새 기능 추가 Chore 🔧 빌드, 설정, 의존성 등 labels Jul 6, 2026
@You-Hyuk You-Hyuk self-assigned this Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@You-Hyuk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: ab2a4476-4fcf-45ad-b3d7-eddbf3bfdd42

📥 Commits

Reviewing files that changed from the base of the PR and between e52bc87 and 7d64959.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (16)
  • .github/workflows/audit.yml
  • .gitignore
  • index.html
  • src/App.jsx
  • src/components/artist/ArtistCard.jsx
  • src/components/ui/ErrorBoundary.jsx
  • src/components/ui/ErrorBoundary.module.css
  • src/main.jsx
  • src/pages/ArtistDetailPage.jsx
  • src/pages/AuthCallbackPage.jsx
  • src/pages/CalendarPage.jsx
  • src/pages/ConcertDetailPage.jsx
  • src/pages/SignupPage.jsx
  • src/stores/loginModalStore.js
  • vercel.json
  • vite.config.js

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@You-Hyuk
You-Hyuk merged commit da6d4b5 into main Jul 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug 🐛 버그 수정 Chore 🔧 빌드, 설정, 의존성 등 Feat ✨ 새 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] 프론트엔드 보안 취약점 수정

1 participant