fix: multi artifact - #4440
Conversation
There was a problem hiding this comment.
Pull request overview
Prevents blast-radius jobs from silently analyzing the wrong artifact in multi-package OSV advisories.
Changes:
- Adds shared advisory-entry selection and tests.
- Applies selection to npm, Maven, and Go stages.
- Documents explicit-package requirements.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
selectAdvisoryEntry.ts |
Adds strict artifact selection. |
selectAdvisoryEntry.test.ts |
Tests selection and rejection paths. |
npm/intelNpm.ts |
Uses shared selection for npm. |
maven/intelMaven.ts |
Uses shared selection for Maven. |
go/intelGo.ts |
Uses shared selection for Go. |
openapi.yaml |
Documents multi-package behavior. |
Suppressed comments (1)
services/apps/packages_worker/src/blast-radius/stages/selectAdvisoryEntry.ts:22
- This counts affected records rather than distinct packages. OSV legitimately repeats one package across multiple
affected[]entries for disjoint ranges, so an omitted package would fail even though the advisory affects only one package, contradicting the new API contract. Check unique normalized package identities and aggregate duplicate records before deciding this is multi-artifact.
if (entries.length > 1) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
f444e4e to
5903630
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
services/apps/packages_worker/src/blast-radius/clients/osvClient.ts:79
- When duplicate entries mix representation styles (for example, one has
rangesand another has onlyversions), this merge retains both fields but bothsemverRangeEventsandmavenRangeEventsconsumeversionsonly when no range events exist. The explicit versions from the second entry are therefore silently excluded from the vulnerable-version set. Please combine explicit versions with range-derived events (and add a mixed ranges/versions regression case) so all duplicate-entry data is analyzed.
if (entry.versions) {
existing.versions = [...new Set([...(existing.versions ?? []), ...entry.versions])]
PR SummaryMedium Risk Overview A new shared
The Akrites blast-radius OpenAPI text is updated to match: advisory-wide submit works only for single-package advisories; multi-package jobs need Reviewed by Cursor Bugbot for commit 5903630. Bugbot is set up for automated code reviews on this repo. Configure here. |
Summary
Fixes a silent-fallback bug in the blast-radius intel stage: when an advisory affects
multiple artifacts (multi-module Go, multi-artifact Maven, multi-package npm) and either no
packagewas requested or the requested package wasn't found in the advisory, the codepicked
entries[0]as a fallback. This meant an advisory-wide analysis on a multi-artifactadvisory silently analyzed only the first affected package, reporting the job as completed
successfully while actually covering just one of several affected artifacts.
Changes
selectAdvisoryEntry(blast-radius/stages/selectAdvisoryEntry.ts), a shared helperused by npm/Go/Maven's intel stages that replaces the
find(...) || entries[0]fallbackpattern:
back to the first entry
analysis is only valid for single-artifact advisories) — the failure is loud
(
status: 'failed') rather than a misleadingly "successful" partial analysisas before
intelGo.ts,intelMaven.ts,intelNpm.tsto useselectAdvisoryEntryinstead oftheir own inline fallback logic.
packagefielddescription) to document that advisory-wide analysis is only supported for single-package
advisories, and that multi-package advisories require an explicit
package.selectAdvisoryEntry.test.tscovering: single-entry no-request pass-through,matching-request selection, non-matching-request rejection, and omitted-request rejection
against a multi-artifact advisory.
Type of change
JIRA ticket