fix-security-vulnerability

oleh sentry

Menganalisis dan mengusulkan perbaikan untuk peringatan keamanan Dependabot

npx skills add https://github.com/getsentry/sentry-changelog --skill fix-security-vulnerability

Fix Security Vulnerability Skill

Analyze Dependabot security alerts and propose fixes for the sentry-changelog Next.js app. Does NOT auto-commit - always presents analysis first and waits for user approval.

Input

  • Dependabot URL: https://github.com/getsentry/sentry-changelog/security/dependabot/12
  • Or just the alert number: 12

Workflow

Step 1: Fetch Vulnerability Details

gh api repos/getsentry/sentry-changelog/dependabot/alerts/<alert-number>

Extract: package name, vulnerable/patched versions, CVE ID, severity, description.

Step 2: Analyze Dependency Tree

pnpm why <package-name>

Determine if it's a direct or transitive dependency, and whether it's production or dev.

Step 3: Determine Fix Strategy

Check for pinned dependencies

Some dependencies are intentionally pinned due to compatibility constraints. Check package.json comments (the "//" field) for pin reasons before bumping.

Known pins:

  • google-auth-library - Pinned to v9.x to match @google-cloud/storage's bundled version (v10.x breaks Vercel OIDC auth)

For other dependencies

TypeAction
Patch bump availablePreferred - lowest risk
Minor bump neededUsually safe
Major bump neededAnalyze breaking changes first
Transitive dependencyBump the parent package (see below)

Step 3a: Transitive Dependencies

If the vulnerable package is pulled in by another package:

1. Identify and check the parent:

pnpm why <vulnerable-package>
npm view <parent-package>@latest dependencies.<vulnerable-package>

2. Fix approach:

ScenarioAction
Parent has newer version with fixBump the parent
Parent hasn't released fixWait, or open an issue upstream

AVOID pnpm.overrides. Forcing a transitive dependency version can break the parent package silently. Only consider overrides if:

  • No upstream fix exists AND it's a production-critical vulnerability
  • The forced version is a patch/minor bump (not major)
  • You've manually verified compatibility

Step 4: Present Analysis

Present findings and wait for user approval before making changes:

## Security Vulnerability Analysis

**Package:** <name> | **Severity:** <severity> | **CVE:** <id>
**Vulnerable:** <range> | **Patched:** <version>

### Dependency Chain
<pnpm why output>

### Recommendation
<One of: Safe to bump / Intentionally pinned - do not bump / Bump parent package>

### Proposed Fix
1. Update package.json: "<package>": "<new-version>"
2. pnpm install
3. Verify with: pnpm why <package>

Proceed?

Step 5: Apply Fix (After Approval)

# 1. Edit package.json
# 2. Update lockfile
pnpm install
# 3. Verify
pnpm why <package>
# 4. Run tests
pnpm test:run
# 5. Show changes
git diff

Do NOT commit - let the user review first.

Step 5 (Alternative): Dismiss Alert

For alerts that should not be fixed, offer to dismiss instead.

Always get user approval first. Present the dismissal option:

This alert should be dismissed rather than fixed because:
- <reason: intentionally pinned / dev-only acceptable risk / etc.>

Dismiss with reason: <suggested reason>
Comment: "<suggested comment>"

Proceed with dismissal?

After user approval, dismiss via GitHub API:

gh api --method PATCH repos/getsentry/sentry-changelog/dependabot/alerts/<number> \
  -f state=dismissed \
  -f dismissed_reason=<reason> \
  -f dismissed_comment="<comment>"

Dismissal reasons:

ReasonWhen to use
tolerable_riskDev-only dependency, risk accepted
no_bandwidthWill fix later, not urgent
inaccurateFalse positive, not actually vulnerable
not_usedVulnerable code path is not used in our code

Commands Reference

CommandPurpose
pnpm why <pkg>Show dependency tree
gh api repos/getsentry/sentry-changelog/dependabot/alerts/<n>Fetch alert
gh api --method PATCH .../dependabot/alerts/<n> -f state=dismissed -f dismissed_reason=<reason>Dismiss alert
npm view <pkg>@latest dependencies.<dep>Check transitive dep version
pnpm test:runRun tests

Examples

Direct dependency - safe to bump

Package: contentful
Severity: moderate
Type: Production dependency (direct)

Recommendation: Safe to bump 10.15.0 → 10.16.0
- Patch version, low risk
- No breaking changes expected

Pinned dependency - dismiss instead

Package: google-auth-library
Severity: high

Recommendation: DISMISS (do not bump to v10.x)
This package is intentionally pinned to v9.x for compatibility
with @google-cloud/storage's bundled ExternalAccountClient.
Bumping to v10.x breaks Vercel OIDC authentication.

Proposed dismissal:
  Reason: tolerable_risk
  Comment: "Pinned to v9.x for @google-cloud/storage compat - see package.json comments"

Proceed with dismissal?

Transitive dependency - bump parent

Package: vulnerable-lib@1.9.0 (needs >=2.0.1)
Chain: @sentry/nextjs → @sentry/node → vulnerable-lib

Check: npm view @sentry/nextjs@latest dependencies
Result: Uses patched version ✓

Recommendation: Bump @sentry/nextjs 10.32.1 → 10.33.0
This pulls in the patched vulnerable-lib automatically.

Transitive dependency - no fix available

Package: deep-lib@2.9.0 (needs >=3.0.0)
Chain: next → some-pkg → deep-lib

No upstream fix available yet. Options:
1. Wait for upstream fix (preferred)
2. Accept risk if dev-only
3. Consider pnpm.overrides as last resort for production-critical issues

AVOID using overrides unless absolutely necessary.

Important Notes

  • Never auto-commit - Always wait for user review
  • Check pin reasons - Some deps are pinned for compatibility (see "//" in package.json)
  • Dev vs Prod matters - Dev-only vulnerabilities are lower priority
  • Bump parents, not transitive deps - If A depends on vulnerable B, bump A
  • Avoid pnpm.overrides - They bypass the parent's dependency constraints and can cause subtle breakage
  • Always verify - Run pnpm why <pkg> after fixing to confirm the patched version is installed
  • Run tests - Run pnpm test:run after fixing to make sure nothing broke

Lebih banyak skill dari sentry

generate-frontend-forms
sentry
Panduan untuk membuat formulir menggunakan sistem formulir baru Sentry. Gunakan saat mengimplementasikan formulir, kolom formulir, validasi, atau fungsionalitas penyimpanan otomatis.
official
sentry-snapshots-cocoa
sentry
Pengaturan lengkap Sentry Snapshots untuk proyek Apple/Cocoa. Gunakan saat diminta untuk "setup SnapshotPreviews", "setup Apple snapshot testing", "upload Apple snapshots to…
official
architecture-review
sentry
Tinjauan kesehatan basis kode setara staf. Menemukan modul monolitik, kegagalan diam, celah keamanan tipe, lubang cakupan pengujian, dan masalah keramahan LLM.
official
linear-type-labeler
sentry
Mengklasifikasikan isu Linear dan menerapkan label Tipe dari taksonomi label ruang kerja Sentry berdasarkan konten judul dan deskripsi setiap isu.
official
sentry-flutter-sdk
sentry
Pengaturan SDK Sentry lengkap untuk Flutter dan Dart. Gunakan saat diminta untuk "menambahkan Sentry ke Flutter", "menginstal sentry_flutter", "menyiapkan Sentry di Dart", atau mengonfigurasi error…
official
sentry-svelte-sdk
sentry
Pengaturan SDK Sentry lengkap untuk Svelte dan SvelteKit. Gunakan saat diminta untuk "menambahkan Sentry ke Svelte", "menambahkan Sentry ke SvelteKit", "menginstal @sentry/sveltekit", atau mengonfigurasi…
official
vercel-react-best-practices
sentry
Panduan optimasi performa React dan Next.js dari Vercel Engineering. Skill ini harus digunakan saat menulis, meninjau, atau merefaktor kode React/Next.js…
official
sentry-tanstack-start-sdk
sentry
Pengaturan SDK Sentry lengkap untuk TanStack Start React. Gunakan saat diminta untuk "menambahkan Sentry ke TanStack Start", "menginstal @sentry/tanstackstart-react", atau mengonfigurasi error…
official