Skip to content

Conversation

@daahyunk
Copy link
Member

@daahyunk daahyunk commented Sep 30, 2025

📌 Summary

최근 npm 관련 보안 사고 및 안전성 강화의 필요성으로 인해 프로젝트 전체에 대해 SBOM을 생성하고(syft), 취약점 스캐너(grype)로 점검했습니다. 스캔 결과 10건의 취약점이 검출되어 발견된 항목들에 대해 조사 및 조치를 진행했습니다. 각 취약점별 상세한 변경사항 등은 오픈소스 보안 취약점 대응 히스토리에 정리해놓았습니다.

자세한 개요는 팀 블로그 아티클로 작성할게요

📚 Tasks

  • 진단
    syft로 SBOM 생성 (syft dir:. -o [email protected]=sbom.json)
    grype로 취약점 스캔 및 리포트 보관 (grype sbom:sbom.json)

  • 취약 패키지 업데이트
    form-data, tmp, vite 등 패치 버전으로 업데이트
    axios 사용부에서 Content-Type 강제 설정을 제거하여 브라우저/axios의 자동 추론을 사용하도록 수정

*esbuild 관련 CVE는 upstream/내부 재검증 결과 false-positive로 판단되어 CI 안정화를 위해 grype ignore 추가를 통해 해결했습니다.
→ 근거(업스트림 이슈): evanw/esbuild#4204

  • CI 연동
    SBOM 생성(syft) 및 취약점 스캔(grype)을 실행하는 GitHub Actions 워크플로우 추가 (high 이상의 취약점 검출 시 CI 실패)
    스캔 결과(sbom.json)를 아티팩트로 업로드하여 감사 및 팀 검토가 가능하도록 설정

  • 대응 히스토리 문서화

👀 To Reviewer

CI 실패 시 조사·대응

1) Actions → 해당 Run 클릭

→ 'Run Grype Scan' 스텝 로그 확인 (로그에 CVE ID / 패키지 / severity 등이 찍혀 있을 거예요)

2) 더 상세한 구조화된 리포트가 필요하면 Artifacts에서 sbom.json을 다운받아 로컬에서 재현

   syft dir:. -o json > sbom.json
   grype sbom:sbom.json -o json > grype-report-root.json || true
   grype sbom:sbom.json

3) CVE 확인

CVE ID(예: CVE-2025-XXXX)를 복사해 Google/NVD/GitHub에서 검색 → 영향 범위 · 패치 여부 확인

4) 대응 방법

  • 패치 가능일 때
    관련 패키지가 보안 패치를 제공했다면 버전 업그레이드 PR 생성
    *업그레이드 후에는 반드시 사이드 이펙트가 없는지, 동작은 잘 하는지 꼼꼼히 테스트 해주세요.

  • 패치 불가 / 영향 없음
    repo 루트에 .grype.yaml 템플릿을 만들어두었습니다. 해당 파일에 ignore 항목을 추가하면 해당 취약점에 대해서는 grype가 스캔하지 않아요. 아래 예시처럼 igonore: 배열에 CVE를 등록하면 됩니다.

ignore:
  - vulnerability: CVE-2025-22874
    package:
      name: esbuild
      type: npm
    reason: "Upstream confirmed false positive. See: https://github.com/evanw/esbuild/issues/4204"
    until: "2025-12-31"

reason에는 반드시 근거(upstream issue, 공식 패치 계획 등)를 남겨주세요.
until은 임시 예외일 경우 꼭 작성해 주세요.

  • false positive (오탐) 가능성
    grype는 실행 시 실제 코드의 런타임 사용 여부를 분석하지 않고 SBOM(패키지/버전 메타데이터)을 기준으로 CVE를 매칭합니다. 따라서 우리가 직접 사용하지 않는 모듈(또는 빌드 시 제거되는 함수)을 포함한 간접 의존성의 간접 의존성에서도 취약점이 탐지될 수 있어요 (이번에는 vite → esbuild 경로의 간접 의존성에서 탐지됐어요) 이럴 경우 무작정 패치/업데이트만 하지 말고 반드시 해당 패키지의 리포지토리(업스트림 이슈/릴리스 노트)를 확인하고 maintainer 코멘트나 패치 여부를 근거로 triage 해주세요.

5) 재검증

📸 Screenshot

10건 -> 0건으로 해결

image 스크린샷 2025-09-30 오후 2 14 58

@daahyunk daahyunk self-assigned this Sep 30, 2025
@daahyunk daahyunk requested a review from a team as a code owner September 30, 2025 02:48
@daahyunk daahyunk added the 🛠️ Refactor 코드 리팩토링 label Sep 30, 2025
@daahyunk daahyunk linked an issue Sep 30, 2025 that may be closed by this pull request
@daahyunk daahyunk added the 다현 🎧 다현 label Sep 30, 2025
@changeset-bot
Copy link

changeset-bot bot commented Sep 30, 2025

⚠️ No Changeset found

Latest commit: dbed7d3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 30, 2025

🏴‍☠️ Storybook 확인: 🔗 https://677bd6bc4909f2f48f4e0f42-xlmiusshxx.chromatic.com/

@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@daahyunk daahyunk marked this pull request as draft September 30, 2025 04:21
@daahyunk daahyunk marked this pull request as ready for review September 30, 2025 05:21
Copy link
Member

@m2na7 m2na7 left a comment

Choose a reason for hiding this comment

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

너무 고능한 작업 고생많으셨어요 ㅎㅎ.

추가로 vite나 vanilla-extract 처럼 많은 패키지에서 사용되는 의존성들도 pnpm-workspace내 catalog에 추가해줘도 좋을 것 같아요!
그리고 조금 낡아버린.. 의존성들이 있는데 오래된 버전일 수록 취약점이 드러나기 마련이니 이번 작업에서 한 번 싹 업데이트 해주는거는 어떨까요?

@daahyunk
Copy link
Member Author

daahyunk commented Oct 1, 2025

너무 고능한 작업 고생많으셨어요 ㅎㅎ.

추가로 vite나 vanilla-extract 처럼 많은 패키지에서 사용되는 의존성들도 pnpm-workspace내 catalog에 추가해줘도 좋을 것 같아요! 그리고 조금 낡아버린.. 의존성들이 있는데 오래된 버전일 수록 취약점이 드러나기 마련이니 이번 작업에서 한 번 싹 업데이트 해주는거는 어떨까요?

좋아요 물갈이 함 해주겟습니다 ㅎ,ㅎ

Copy link
Member

@gwagjiug gwagjiug left a comment

Choose a reason for hiding this comment

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

좋은데요, 원리에 대한 설명은 나중에 팀 블로그 및 미팅으로 채워주세요. 기능개발이 아니라 프로세스 하나가 추가된 것 같아서 재밌네요

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.

[Feature]: SBOM 기반 보안 취약점 검사 도입

4 participants