diagnosing-dependabot-alerts

작성자: medusajs

Diagnoses GitHub Dependabot / security alerts in the Medusa monorepo and finds the least-invasive fix. Use when investigating a Dependabot alert, security…

npx skills add https://github.com/medusajs/medusa --skill diagnosing-dependabot-alerts

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.

Constraints

  • Diagnose first, don't default to a fix: Never jump to a root resolutions/overrides bump. Root-level overrides are the LAST resort — see the remediation ladder.
  • Root overrides don't ship: 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.
  • Find the fix inside the affected package first: Prefer refreshing/bumping the dependency within the workspace package that owns it (transitive refresh or direct-dep bump) before touching anything at the monorepo root.
  • Reachable is not pinnable: A fixed version being resolvable within existing semver ranges (a lockfile float) is weaker than a range that GUARANTEES the fix. Call out the difference — the float can regress for downstream consumers.
  • Assess impact, don't assume: Determine whether the vulnerable code path is actually reachable with untrusted input in Medusa before recommending urgency.

Workflow

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

1. Fetch alert details

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.

2. Trace to the exact affected Medusa package(s)

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:

  1. grep -n "<pkg>@npm" yarn.lock — list installed versions; confirm which match the vulnerable range.
  2. Walk up dependents (grep the version string as a dependency of other lock entries) until you reach a package declared in a packages/*/package.json.
  3. For that workspace package, determine:
    • Direct vs transitive — is <pkg> (or the nearest ancestor) in its dependencies/devDependencies, or purely transitive?
    • Ships or notprivate: false means it publishes; a runtime dependencies entry ships to consumers. devDependencies and private: true do not.
    • Runtime-reachable — is the ancestor actually imported in 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).

3. Assess real impact

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.

4. Choose remediation (least-invasive first)

Load reference/remediation-strategies.md now. Apply the ladder in order and stop at the first tier that works without breaking changes:

TierFixScopeShips to consumers?
1aIn-range transitive refresh (lockfile only)affected pkg's treereflects fresh installs
1bBump the direct dep the affected pkg declaresaffected pkg's package.jsonyes (enforced)
2Root resolutions/overridesthis repo onlyNO — last resort
  • Prefer 1a when a fixed version is reachable within existing ranges and introduces no breaking changes (fastest, no manifest change).
  • Use 1b when the fix is only guaranteed by bumping the declared dep — check breaking changes (major bump, peerDeps, changed API usage) per the reference file.
  • Use 2 only when no in-package option exists; always state that it does not protect downstream consumers of published packages.

5. Verify (only when making changes)

  • git diff --stat — confirm the change is scoped (only yarn.lock, plus package.json if you bumped a direct dep).
  • Confirm NO version matching the vulnerable range remains in yarn.lock.
  • Confirm the diff touches only the vulnerable package's dependency neighborhood — no unrelated churn.
  • If a direct dep was bumped: build/typecheck the affected package and exercise its use of the dependency.

Reference Files Available

reference/remediation-strategies.md  - Tracing recipe, semver reachable-vs-pinnable
                                        analysis, per-tier commands, breaking-change checks

Common Mistakes Checklist

Verify you're NOT doing these:

  • Adding a root resolutions/overrides entry as the first (or only) fix
  • Presenting a root override as protecting downstream consumers of a published package
  • Treating a lockfile float ("reachable") as a guaranteed fix ("pinnable")
  • Skipping the trace and not naming the exact affected packages/* package(s)
  • Recommending a major-version bump without checking breaking changes / peerDeps / actual usage
  • Reporting urgency without checking whether the vulnerable path is reachable in Medusa
  • Making changes when only a diagnosis was requested

medusajs의 다른 스킬

mcloud-variables
medusajs
mcloud variables 명령어를 실행하여 Cloud 환경의 환경 변수를 나열하고 가져옵니다. 환경을 검사하거나 읽거나 내보낼 때 사용합니다.
official
building-storefronts
medusajs
SDK 기반의 Medusa 스토어프론트 통합으로, React Query 패턴과 중요한 API 호출 규칙을 포함합니다. 모든 API 요청에는 항상 Medusa JS SDK를 사용해야 하며, 일반 fetch()는 사용하지 않습니다. fetch()는 필수 헤더(스토어 라우트의 publishable API 키, 관리자 라우트의 인증)가 누락되기 때문입니다. SDK 메서드에는 일반 JavaScript 객체를 전달하며, 본문 매개변수에 JSON.stringify()를 사용하지 않습니다. SDK가 자동으로 직렬화를 처리합니다. GET 요청에는 useQuery를, POST/DELETE 요청에는 useMutation을 사용합니다.
official
building-admin-dashboard-customizations
medusajs
Medusa Admin 대시보드용 맞춤 UI 확장 기능으로, Admin SDK와 Medusa UI 컴포넌트를 사용합니다. 모든 관리자 UI 작업(계획, 구현, 탐색) 시 이 스킬을 먼저 로드하세요. MCP 서버는 API 참조만 제공하며, 디자인 패턴이나 데이터 로딩 전략은 제공하지 않습니다. 중요: 모든 API 요청에는 Medusa JS SDK를 사용하고(일반 fetch 사용 금지), 표시 쿼리와 모달 쿼리를 분리하며, 변형 후에는 표시 데이터를 무효화하세요. 기존 페이지에 위젯을 구현하거나 맞춤 UI 라우트를 생성하세요.
official
learning-medusa
medusajs
대화형 단계별 메두사 개발 부트캠프로, 브랜드 기능을 구축하면서 아키텍처 패턴을 학습합니다. 모듈, 워크플로우, API 라우트, 모듈 링크, 워크플로우 훅, 관리자 UI 커스터마이징을 다루는 3개의 점진적 레슨(총 2~3시간)으로 구성됩니다. 각 주요 구성 요소 이후 체크포인트 검증을 통해 개념 이해도, 코드 품질, 기능성을 확인한 후 진행합니다. 오류를 교육 기회로 활용하며, 진단 질문과 근본 원인 분석을 통해 함께 디버깅합니다...
official
db-migrate
medusajs
보류 중인 Medusa 데이터베이스 마이그레이션을 실행하고 결과를 보고합니다. Bash를 통해 npx medusa db:migrate를 실행하여 보류 중인 모든 마이그레이션을 Medusa 데이터베이스에 적용합니다. 적용된 마이그레이션 수, 발생한 오류, 성공 확인을 포함한 마이그레이션 결과를 보고합니다. 표준 npm/npx 설정을 사용하는 Medusa 프로젝트용으로 설계되었습니다.
official
mcloud-environments
medusajs
mcloud environments 명령을 실행하여 Cloud 환경을 나열, 조회, 생성, 삭제, 재배포 또는 빌드를 트리거합니다. 환경 수명 주기를 관리할 때 사용합니다.
official
db-generate
medusajs
단일 명령어로 Medusa 모듈의 데이터베이스 마이그레이션을 생성합니다. npx medusa db:generate CLI 명령을 래핑하여 지정된 Medusa 모듈의 마이그레이션 파일을 생성합니다. 모듈 이름을 인수로 받아 마이그레이션 파일 위치, 오류 및 다음 단계를 보고합니다. 생성 후 마이그레이션을 적용하기 위해 npx medusa db:migrate를 실행하도록 자동으로 제안합니다.
official
mcloud-deployments
medusajs
Execute mcloud deployments commands to list deployments, retrieve deployment details, and fetch build logs. Use when listing deployments, checking deployment…
official