← Back to Pull requests

fix(registry): read every page of OSV results when checking for malicious packages #2036

Closed
unknown closed this pull request without merging on Dec 03, 2026 22:15 UTC
View on GitHub
unknown unknown commented on Dec 03, 2026 21:38 UTC
Author

aube's malicious-package check asks OSV's /v1/querybatch about each package. When a package has a lot of advisories, OSV splits them across pages and returns a next_page_token with the first page. aube read only that first page, so a MAL- advisory on a later page was never seen. The package installed even with advisoryCheck = required.

This affected both OSV checks: the name check aube add runs before resolving, and the version-aware check of every newly resolved package after resolving.

Before: OSV returns a first page of ordinary GHSA- advisories plus next_page_token, and the MAL- entry is on page 2. aube installs the package.

After: aube sends a follow-up batch for only the queries that came back with a token, passing each token as page_token (with the same name and version), and merges the pages until no tokens remain. The MAL- advisory is found and the install is blocked, or a warning is shown, exactly as for a first-page hit.

If OSV is still returning tokens after 16 pages, aube treats the check as failed rather than clean. advisoryCheck = required then stops the install, and advisoryCheck = on warns and continues, the same as for any other OSV error. A real package needs one or two pages.

If a later page fails, any MAL- advisory already read from earlier pages still blocks the install, even under advisoryCheck = on. A package whose pages were not all read never counts as clean.

Unpaginated results, which is nearly every package, still take one request per batch. The follow-up requests only happen for packages OSV actually paginates.

Validation: new unit tests feed the paging loop a three-page result and check that the MAL- hit from page 3 is found. They also check that follow-up queries keep the version and token that a server that never stops paging fails the probe, and that a hit from page 1 survives a failed page 2. Clippy and the supply_chain tests pass. There was no live OSV run, because this environment can't reach api.osv.dev.

🤖 Generated with Claude Code

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: unavailable.

---
_Generated by Claude Code_

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

<!-- coderabbit-ai-generated:v1 -->

Summary by CodeRabbit

Bug Fixes
Supply-chain advisory lookups now follow pagination across up to 16 pages, helping include advisories from later results.
Results with more pages remaining are no longer treated as clean. If a lookup cannot be completed, confirmed malicious results are still returned; an unfinished lookup with no confirmed hits returns an error.
Lookups that exceed the supported page limit return an error rather than continuing indefinitely.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 363 lines (+272 / -91) across 4 files Reviewer: jdx Review duration: 37m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 363 lines diff across 4 files
0.43
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.353
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2036"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.7% (MEDIUM) · Higher = larger blast radius
42.7%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.9% · Safe to merge
16.9%
Repository