fix: preserve maximum advisory severity - #1401
Conversation
📝 WalkthroughWalkthrough감사 advisory의 식별자와 severity를 정규화·검증하고, 중복 결과를 결정적으로 병합하도록 정책 로직과 테스트 픽스처를 확장했습니다. 리포트의 Advisory 표시값은 GHSA, CVE, audit id 순으로 선택됩니다. Changes감사 advisory 병합 정책
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AuditFiles
participant normalizeAdvisory
participant mergeAdvisories
participant Report
AuditFiles->>normalizeAdvisory: advisory 데이터 전달
normalizeAdvisory->>mergeAdvisories: canonical advisory 전달
mergeAdvisories->>mergeAdvisories: 식별자별 병합 및 최대 severity 선택
mergeAdvisories->>Report: 병합된 evidence 전달
Report-->>AuditFiles: Advisory 컬럼 포함 리포트 생성
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/dependency-audit-policy.mts`:
- Around line 349-358: Update advisoryKey and its merge lookup flow in
scripts/dependency-audit-policy.mts:349-358 to consider every normalized CVE
alias, rather than only advisory.cves[0], so advisories sharing any CVE resolve
to the same merge group and retain maximum severity. Add a regression test in
scripts/tests/dependency-audit-policy.spec.ts:421-467 where the shared CVE is
not the first sorted CVE on one side, verifying the advisories merge correctly.
In `@scripts/tests/dependency-audit-policy.spec.ts`:
- Around line 950-960: Update expectPolicyProblem so it captures the exception
from run and performs the expected rejection assertion after the try/catch,
removing the generic Error sentinel entirely. Ensure the helper still verifies
the captured exception has category "BadRequest" and the provided message, and
only Problem subclasses are thrown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a58612be-4c63-4cc4-8c5d-f0b9389776b2
📒 Files selected for processing (2)
scripts/dependency-audit-policy.mtsscripts/tests/dependency-audit-policy.spec.ts
📊 Benchmark Results✅ All benchmarks passed
Updated: 2026-07-15T11:42:32.917Z · Commit: 64a9171 |
|
@coderabbitai resolve |
✅ Action performedComments resolved and changes approved. |
Fixes #1340.
Summary
Merged dependency-audit evidence now preserves the maximum observed severity regardless of audit-pass order, so later low or moderate records cannot downgrade high or critical blockers.
Advisory identities are normalized through validated GHSA, CVE, and audit-id namespaces. Merge grouping considers every normalized alias and absorbs intersecting groups transitively, including cases where the shared CVE is not the first sorted CVE. Missing or malformed identity and severity evidence fails closed with stable diagnostics.
Merged paths, CVEs, scalar evidence, advisory ordering, and generated reports are deterministic across reversed inputs.
Verification
pnpm vitest run scripts/tests/dependency-audit-policy.spec.ts scripts/tests/release-workflow.spec.ts— 49/49 passedcritical, produced byte-identical reports, and malformed or hostile evidence exited nonzero without reflecting payloadspnpm check— passedpnpm typecheck— 226/226 tasks passed across 115 packagespnpm test— 227/227 tasks passedpnpm changeset-required:check— passed; no publishable package changesvalidate,changes,benchmark,companion, WIP, and CodeRabbit — passedgit diff --check— passedpnpm security:audit-policycannot currently reach npm's retired legacy audit endpoint; the registry returns HTTP 410 and directs clients to the bulk advisory endpoint. GitHub CI's dependency audit policy report passed, and the local policy suite plus real CLI fixtures cover the changed behavior without network dependency.Review gates
No known issue-scoped residual risk remains.