feat(core): replace Socket.dev supply-chain check with OSV (osv.dev) - #1080
feat(core): replace Socket.dev supply-chain check with OSV (osv.dev)#1080devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
commit: |
…artial vuln results Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
| (vulnerability) => | ||
| vulnerability.id.toUpperCase().startsWith("MAL-") || | ||
| vulnerability.summary.toLowerCase().includes("malicious package"), | ||
| ); |
There was a problem hiding this comment.
Malware help misses details text
Medium Severity
Malware handling is inconsistent: resolveVulnerabilitySeverity treats an advisory as malware when isMalwareAdvisory finds malicious package in summary or details, but buildOsvDiagnostic’s hasMalware only checks the cached summary (which prefers summary over details). Advisories with that phrase only in details can get critical gating yet generic “upgrade” help and “known vulnerability” wording instead of compromised-package guidance.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 4075b4d. Configure here.
Runtime test results — OSV supply-chain checkRan the built CLI against fixture
Test 1 —
|
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f428673. Configure here.
|
|
||
| return Array.from({ length: dependencyCount }, (_, index) => | ||
| parseOsvQueryBatchResult(results[index]), | ||
| ); |
There was a problem hiding this comment.
Short batch results cache false negatives
Medium Severity
parseOsvQueryBatchResponse maps each dependency to results[index] without requiring results.length to match the query count. Missing entries become empty id lists, those packages skip /v1/query, and the checker writes an empty vulnerability list to the 24-hour cache as if the package were clean.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f428673. Configure here.


Summary
Replaces the Socket.dev dependency check (the
SupplyChainservice) with Google's OSV (osv.dev). The old check hit an unofficial, undocumented free endpoint (firewall-api.socket.dev/purl/...) and gated on a proprietary 0–100 composite score. OSV is an official, documented, no-auth API that aggregates GHSA/CVE advisories and the OpenSSF malicious-packages dataset, so diagnostics now name concrete advisory IDs and gate on real vulnerability severity.Why OSV over Socket
GHSA-…/CVE-…/MAL-…IDs and their severities instead of a black-box score.Behavior / gating change
Score-threshold gating is replaced with severity gating:
Severity is normalized to
low | moderate | high | critical, resolved in order:database_specific.severity(GHSA),critical,moderate.Config (public surface) — breaking
supplyChain.minScore(number) → removed, replaced bysupplyChain.failOn(severity).socket→osv, rulelow-supply-chain-score→known-vulnerability. JSON reportschemaVersionunchanged (only theplugin/rulestring values differ).Request strategy (
packages/core/src/check-supply-chain.ts)package.json, concrete floor-version resolution, protocol/wildcard/dist-tag skipping,nextignored, line/col anchoring).POST /v1/querybatchas a cheap prefilter over cold-miss deps → for each dep the batch flags as having ≥1 advisory, one atomicPOST /v1/queryreturning that package's complete vuln set (each record'sseverity/database_specific.severity) in a single response. Concurrency-bounded bySUPPLY_CHAIN_FETCH_CONCURRENCY./v1/vulns/{id}): an earlier revision expanded each advisory ID via a separate/v1/vulns/{id}request; a single transient failure there silently dropped that advisory (potentially a CRITICAL) and wrote the incomplete set to the 24h cache — an under-report that then stuck (flagged by Cursor Bugbot as "Caches empty OSV vuln lists", now resolved). The atomic per-package query fixes this: network calls retry (SUPPLY_CHAIN_FETCH_MAX_RETRIES, exponential backoff, each attempt bounded byFETCH_TIMEOUT_MS), and a package whose query ultimately fails is fail-open and never cached (no diagnostic this run, retried next run) — a partial/poisoned result is never persisted.SUPPLY_CHAIN_OVERLAP_TIMEOUT_MS→[]. An OSV outage never sinks a scan.package.jsonline/col,category: "Security",url→https://osv.dev/vulnerability/{id}.SOCKET_*removed,OSV_API_BASE/OSV_VULN_PAGE_BASEadded.Testing
/v1/querystubs): severity gating at eachfailOnlevel, malware→critical, dist-tag/wildcard/protocol skipping, devDeps toggle, cache hit/miss/stale/REACT_DOCTOR_NO_CACHE, fail-open on whole-check timeout, and a regression test that a failed package query yields no diagnostic and no cache write, with a later successful run recovering the advisory.pnpm build,pnpm typecheck,pnpm lintpass.@react-doctor/core: 1185/1185 tests pass.lodash@4.17.11): 8/8 no-cache runs stably report all 4 high+critical advisories (incl. the CRITICALGHSA-jf85-cpcp-j695).Link to Devin session: https://app.devin.ai/sessions/2f944c3dfeb147b9a6da4940bd598585
Requested by: @aidenybai
Note
Medium Risk
Breaking public config (
minScoreremoval) and diagnostic identity changes affect CI and integrations; security scanning now depends on OSV API behavior and severity parsing instead of Socket scores.Overview
Replaces the Socket.dev supply-chain check with OSV (
api.osv.dev) across the core checker, CLI, config schema, and tests. Dependencies are no longer scored on Socket’s composite 0–100 axes; they are checked against catalogued advisories (GHSA/CVE/MAL) with severity gating viasupplyChain.failOn(default"high") instead ofminScore(removed).The checker uses querybatch plus per-package
/v1/query, retries failed HTTP calls, and keeps per-PURL on-disk cache (empty results cached; failed queries are not). Diagnostics use pluginosv, ruleknown-vulnerability, and list advisory IDs with links to osv.dev. Malware advisories are always treated as critical.Breaking config/report surface:
supplyChain.minScore→supplyChain.failOn; diagnosticplugin/rulestrings change. Orchestration (background overlap, fail-open timeouts, diff manifest behavior) is unchanged aside from Socket → OSV wording.Reviewed by Cursor Bugbot for commit f428673. Bugbot is set up for automated code reviews on this repo. Configure here.