Skip to content

feat(gate): add a lockfile-tamper-risk check #2563

Description

@JSONbored

Parent: #1936

Problem

No check exists that a changed package-lock.json (or review-enrichment/package-lock.json, apps/gittensory-ui/package-lock.json) stays internally consistent with its package.json, or that lockfile entries weren't hand-edited to swap a resolved tarball URL/integrity hash for something outside the registry's normal resolution — a classic supply-chain vector. npm ci only catches STRUCTURAL mismatch locally for the person running it; nothing surfaces a maliciously-crafted-but-internally-consistent lockfile edit as a gate finding the way secret_leak does. This is real but speculative — no evidence of exploitation, lower priority than the other findings in this batch.

Requirements

  • Add an advisory-by-default (block opt-in, matching house style) lockfile_tamper_risk finding: flag any diff hunk inside a package-lock.json/*.lock file where a resolved:/integrity: value changed WITHOUT the corresponding package.json dependency version changing, or where a resolved URL points outside registry.npmjs.org.
  • Config-driven gate dimension (gate.lockfileIntegrity: off|advisory|block), off by default.
  • Distinct from feat(enrichment): dependency-diff + OSV.dev CVE analyzer #1474 (dependency-diff + OSV.dev CVE analyzer) — that covers KNOWN-CVE detection in changed deps, this covers lockfile-tamper/resolved-URL integrity, a different threat model.

Deliverables

  • A new gate rule producing a lockfile_tamper_risk finding when the conditions above are met.
  • The gate.lockfileIntegrity setting wired through the config-as-code chain.
  • Tests: a legitimate dependency bump (version + resolved + integrity all change together) does not trigger; a hand-edited resolved/integrity with no corresponding version bump does trigger; a resolved URL outside the npm registry triggers.

Acceptance criteria

  • A tampered lockfile entry (resolved/integrity changed without version bump, or non-registry URL) produces the advisory finding.
  • A normal npm install-driven lockfile update does not false-positive.
  • Off by default.

Expected outcome

A previously entirely-silent supply-chain vector (hand-edited lockfile entries) gets a real, if currently low-priority, deterministic gate signal — available to enable for repos with elevated supply-chain concerns.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.roadmapOn the Wave-2 agent-layer roadmap board (project 9)

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions