Skip to content

feat(enrichment): detect vulnerable lockfile drift#1703

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
tmimmanuel:feat/1502-lockfile-drift-osv
Jun 29, 2026
Merged

feat(enrichment): detect vulnerable lockfile drift#1703
JSONbored merged 1 commit into
JSONbored:mainfrom
tmimmanuel:feat/1502-lockfile-drift-osv

Conversation

@tmimmanuel

Copy link
Copy Markdown
Contributor

Summary

  • Add a REES lockfile-drift analyzer for feat(enrichment): Vulnerable transitive-pin & lockfile-drift analyzer #1502 that parses package-lock.json, yarn.lock, and poetry.lock hunks for lockfile-only resolved dependency changes.
  • Batch-query OSV.dev for vulnerable resolved versions, excluding packages already named by top-level manifest diffs so the brief focuses on transitive drift.
  • Render a public-safe lockfile drift section with file:line, package@version, severity, CVE, and fixed version when OSV provides one.

Closes #1502

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥97% coverage of the lines AND branches you changed (aim for 98%+ on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

Additional validation:

  • cd review-enrichment && npm test (107 tests)

If any required check was skipped, explain why:

  • None.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. N/A: no auth/session/platform boundary changes.
  • API/OpenAPI/MCP behavior is updated and tested where needed. N/A: no API/OpenAPI/MCP contract changes.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. N/A: no UI changes.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository. N/A: no visible UI changes.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

N/A: no visible UI, frontend, docs page, or extension UI changes.

Notes

  • ui:lint exits 0 with existing fast-refresh warnings.

@tmimmanuel tmimmanuel requested a review from JSONbored as a code owner June 29, 2026 00:37
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 29, 2026
@gittensory-orb

gittensory-orb Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review — held for maintainer review

6 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · clean

⏸️ Held for maintainer review — Large change — held for manual review

Review summary
This adds a focused REES analyzer for vulnerable lockfile-only dependency drift, wires it into the existing analyzer registry, and renders the resulting OSV findings with public-safe escaping. The main parsing paths for package-lock, Yarn, and Poetry hunks are covered, including direct-manifest exclusion and sanitizer behavior. I do not see a must-fix correctness defect in the provided post-change files, but there are a few edge cases where the parser can silently miss real drift and where the network batching could be tightened.

Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #1502
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Review load ❌ 8/20 Readiness component derived from cached public PR metadata and labels; size label size:L.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 15 open PR(s), 9 likely reviewable, 6 unlinked.
Contributor context ❌ No public Gittensor match tmimmanuel; not a blocker.
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Nits — 7 non-blocking
  • nit: review-enrichment/src/analyzers/lockfile-drift.ts:49 allows only versions beginning with a digit, so valid npm versions such as prerelease/tag-like resolved values will be skipped without explanation; either document that intentional narrowing or make the predicate match the ecosystems you mean to support.
  • nit: review-enrichment/src/analyzers/lockfile-drift.ts:342 queries duplicate package/version pairs separately when the same resolved package appears in multiple lockfile stanzas, which wastes part of the 40-query budget before findings are mapped back by key.
  • nit: review-enrichment/src/analyzers/lockfile-drift.ts:364 treats an aborted fetch the same as an OSV/network failure and returns empty findings, so timeout-driven degradation is invisible inside this analyzer; that is consistent with best-effort behavior, but worth confirming against the service observability expectations.
  • nit: review-enrichment/src/render.ts:104 still renders license findings with raw code spans and raw license text while this PR hardens dependency and lockfile CVE rendering; consider applying the same safeCodeSpan/promptText convention there for consistency.
  • In review-enrichment/src/analyzers/lockfile-drift.ts:342, dedupe OSV batch queries by `${ecosystem}::${package}@​${to}` before sending the request, then fan the result back to all matching findings so repeated Yarn descriptors do not consume the query cap.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Large change — held for manual review — Split this into smaller, focused PRs, or a maintainer reviews and merges it manually.
Review context
Contributor next steps
  • Review top overlaps.
  • Add scope summary.
  • Fix blocker.
  • Expect slower review.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Review details

Generated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative.

This adds a focused REES analyzer for vulnerable lockfile-only dependency drift, wires it into the existing analyzer registry, and renders the resulting OSV findings with public-safe escaping. The main parsing paths for package-lock, Yarn, and Poetry hunks are covered, including direct-manifest exclusion and sanitizer behavior. I do not see a must-fix correctness defect in the provided post-change files, but there are a few edge cases where the parser can silently miss real drift and where the network batching could be tightened.

Nits (5)

  • nit: review-enrichment/src/analyzers/lockfile-drift.ts:49 allows only versions beginning with a digit, so valid npm versions such as prerelease/tag-like resolved values will be skipped without explanation; either document that intentional narrowing or make the predicate match the ecosystems you mean to support.
  • nit: review-enrichment/src/analyzers/lockfile-drift.ts:342 queries duplicate package/version pairs separately when the same resolved package appears in multiple lockfile stanzas, which wastes part of the 40-query budget before findings are mapped back by key.
  • nit: review-enrichment/src/analyzers/lockfile-drift.ts:364 treats an aborted fetch the same as an OSV/network failure and returns empty findings, so timeout-driven degradation is invisible inside this analyzer; that is consistent with best-effort behavior, but worth confirming against the service observability expectations.
  • nit: review-enrichment/src/render.ts:104 still renders license findings with raw code spans and raw license text while this PR hardens dependency and lockfile CVE rendering; consider applying the same safeCodeSpan/promptText convention there for consistency.
  • In review-enrichment/src/analyzers/lockfile-drift.ts:342, dedupe OSV batch queries by `${ecosystem}::${package}@​${to}` before sending the request, then fan the result back to all matching findings so repeated Yarn descriptors do not consume the query cap.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@gittensory-orb gittensory-orb Bot added gittensor Gittensor contributor context gittensor:feature Gittensor-scored feature linked to a feature issue - worth 1.25x multiplier. labels Jun 29, 2026
@tmimmanuel tmimmanuel force-pushed the feat/1502-lockfile-drift-osv branch from 19101b7 to 05de82f Compare June 29, 2026 01:49
@tmimmanuel tmimmanuel force-pushed the feat/1502-lockfile-drift-osv branch from 05de82f to afa6838 Compare June 29, 2026 02:03
@tmimmanuel tmimmanuel force-pushed the feat/1502-lockfile-drift-osv branch 2 times, most recently from 1c2cb01 to 35aab69 Compare June 29, 2026 02:22
@tmimmanuel tmimmanuel force-pushed the feat/1502-lockfile-drift-osv branch from 35aab69 to a00fc21 Compare June 29, 2026 02:32
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 29, 2026
@JSONbored JSONbored merged commit 3303694 into JSONbored:main Jun 29, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue - worth 1.25x multiplier. gittensor Gittensor contributor context lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(enrichment): Vulnerable transitive-pin & lockfile-drift analyzer

2 participants