fix(registry-check): require corroboration for round-version confusion signal - #9
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8
Problem
The dependency-confusion heuristic in
src/ecosystems/shared/registry-check.tsflagged any "round and high" (major > 9, minor/patch = 0) or "comically high" (major >= 100) version number as a confusion signal, andpackageMaxSeverity()escalated that straight tocriticalon its own — with no requirement that anything else about the package actually looked anomalous (registry change, publisher change, missing source tag, ...).In practice this fires on ordinary big-round major releases (e.g. a package jumping from
4x.y.zto50.0.0) even when the registry origin, publisher, and matching source repo tag are all unchanged — a false positive.This heuristic is shared across all supported ecosystems (npm, PyPI, Packagist, deno/JSR) via one module, so the fix applies uniformly to all of them.
Fix
registry-check.ts: split the heuristic's output into a strong signal (private → public registry move — real provenance change, stays critical standalone) and a weakversionShapeSuspicioussignal (round/high version number alone).reconcileConfusionSignal(registryCheck, repoCheck): promotes the weak signal topotentialConfusiononly when corroborated by an actual registry change or a dropped release tag in the source repo (repoCheck.releaseDropped). Wired intocore/analyzer.tsonce, right after each ecosystem'sanalyzeChange()returns — so it applies identically to every ecosystem without touching their individualindex.tsfiles.severity.ts: an uncorroborated round-version signal now surfaces atlowseverity (visible, non-blocking) instead ofcritical; corroborated it still escalates tocriticalas before.types.ts: addedRegistryCheck.versionShapeSuspicious.report.ts/markdown.ts/annotations.ts/sarif.ts: uncorroborated round-version notes are now shown as an informational note ("unusual version number" / SARIFlockscan/version-shape-noteatnotelevel) rather than a "DEPENDENCY CONFUSION" alarm.README.md: documented the corroboration requirement in the "Registry change and dependency confusion" section.Tests
Added
tests/ecosystems/shared/registry-check.test.ts(11 new cases, previously zero direct coverage of this heuristic):lowseveritycriticalcritical, regardless of version shapeAll 69 existing + new tests pass;
tsc --noEmitandbiome checkare clean.🤖 Generated with Claude Code