medusajs/diagnosing-dependabot-alerts
Diagnoses GitHub Dependabot / security alerts in the Medusa monorepo and finds the least-invasive fix. Use when investigating a Dependabot alert, security advisory (GHSA/CVE), vulnerable dependency, "npm audit" finding, or a security update PR. Traces the vulnerable package to the exact affected workspace package(s) under packages/, assesses real impact, and prefers a fix scoped to the affected package over a root package.json / yarn.lock resolutions override (which is a last resort).
npx skills add https://github.com/medusajs/medusa --skill diagnosing-dependabot-alerts
Investigate a Dependabot/security alert in the Medusa monorepo, identify the exact affected package(s), assess real-world impact, and pick the least-invasive fix. Default output is a diagnosis; only make changes when asked.
resolutions/overrides bump. Root-level overrides are the LAST resort — see the remediation ladder.resolutions (yarn) / overrides (npm) apply only to THIS repo's install. They are NOT published with packages/*, so they do not protect downstream consumers of a published package. Never present them as a full fix for a vulnerability that reaches a published package.Follow these steps in order. Load reference/remediation-strategies.md before proposing any fix.
1. Fetch alert details → gh api (package, versions, scope)
2. Trace to affected package → walk yarn.lock up to packages/*
3. Assess real impact → is the vulnerable path reachable?
4. Choose remediation → remediation ladder (least-invasive first)
5. Verify (only if changing) → scoped diff, no vulnerable version remains
The alert number is the last path segment of the URL (.../dependabot/<N>).
gh api repos/medusajs/medusa/dependabot/alerts/<N> | jq '{
state, package: .dependency.package.name, scope: .dependency.scope,
relationship: .dependency.relationship, manifest: .dependency.manifest_path,
ghsa: .security_advisory.ghsa_id, severity: .security_advisory.severity,
summary: .security_advisory.summary,
matched_range: .security_vulnerability.vulnerable_version_range,
first_patched: .security_vulnerability.first_patched_version.identifier,
all_ranges: [.security_advisory.vulnerabilities[] | {range: .vulnerable_version_range, patched: .first_patched_version.identifier}]
}'
Record: the vulnerable package name, every {vulnerable range → first patched} pair, and whether the alert is direct or transitive.
Find which version(s) are actually installed and walk up the dependency chain to the workspace package(s) under packages/ that own the dependency. See reference/remediation-strategies.md for the full tracing recipe. In short:
grep -n "<pkg>@npm" yarn.lock — list installed versions; confirm which match the vulnerable range.packages/*/package.json.<pkg> (or the nearest ancestor) in its dependencies/devDependencies, or purely transitive?private: false means it publishes; a runtime dependencies entry ships to consumers. devDependencies and private: true do not.src/ (runtime), or only used at build/test time?The "affected package" is the workspace package whose manifest declares the dependency (or the nearest ancestor that does).
Before recommending urgency, check whether the vulnerable code path is reachable with untrusted input in Medusa. Example from a past alert: immutable prototype pollution reached us only through @graphql-codegen/typescript, used to generate types from Medusa's OWN internal GraphQL schema — no untrusted input, so practical exploitability was negligible. State the impact explicitly; it changes how aggressive the fix needs to be.
Load reference/remediation-strategies.md now. Apply the ladder in order and stop at the first tier that works without breaking changes:
| Tier | Fix | Scope | Ships to consumers? |
|------|-----|-------|---------------------|
| 1a | In-range transitive refresh (lockfile only) | affected pkg's tree | reflects fresh installs |
| 1b | Bump the direct dep the affected pkg declares | affected pkg's package.json | yes (enforced) |
| 2 | Root resolutions/overrides | this repo only | NO — last resort |
git diff --stat — confirm the change is scoped (only yarn.lock, plus package.json if you bumped a direct dep).yarn.lock.reference/remediation-strategies.md - Tracing recipe, semver reachable-vs-pinnable
analysis, per-tier commands, breaking-change checks
Verify you're NOT doing these:
resolutions/overrides entry as the first (or only) fixpackages/* package(s)Take medusajs/diagnosing-dependabot-alerts from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.