You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2026. It is now read-only.
- Introduced `git pkgs integrity` command to show and verify lockfile integrity hashes.
- Added `--drift` flag to detect packages with different hashes for the same version.
- Updated `ecosystems-bibliothecary` to ~> 15.3 and `purl` to >= 1.7.1
- Enhanced `dependency_snapshots` table to store integrity hashes (schema v4).
- Updated documentation to include integrity verification details.
- Modified various components to support integrity tracking and reporting.
- Added tests for integrity command and lockfile integrity extraction.
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -322,6 +322,19 @@ Output formats: `text` (default), `json`, and `sarif`. SARIF integrates with Git
322
322
323
323
Vulnerability data is cached locally and refreshed automatically when stale (>24h). Use `git pkgs vulns sync --refresh` to force an update. See [docs/vulns.md](docs/vulns.md) for full documentation.
324
324
325
+
### Integrity verification
326
+
327
+
Show SHA256 hashes from lockfiles. Modern lockfiles include checksums that verify package contents haven't been tampered with.
328
+
329
+
```bash
330
+
git pkgs integrity # show hashes for current dependencies
331
+
git pkgs integrity --drift # detect same version with different hashes
332
+
git pkgs integrity -f json # JSON output
333
+
git pkgs integrity --stateless # no database needed
334
+
```
335
+
336
+
The `--drift` flag scans your history for packages where the same version has different integrity hashes, which could indicate a supply chain issue.
Copy file name to clipboardExpand all lines: docs/internals.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ The schema has ten tables. Six handle dependency tracking:
19
19
-`branch_commits` is a join table preserving commit order within each branch
20
20
-`manifests` stores file paths with their ecosystem (npm, rubygems, etc.) and kind (manifest vs lockfile)
21
21
-`dependency_changes` records every add, modify, or remove event
22
-
-`dependency_snapshots` stores full dependency state at intervals
22
+
-`dependency_snapshots` stores full dependency state at intervals, including lockfile integrity hashes
23
23
24
24
Four more support vulnerability scanning and package enrichment:
25
25
@@ -227,6 +227,25 @@ The `licenses` command checks licenses against configured policies:
227
227
228
228
The command exits with code 1 when violations are found, making it suitable for CI pipelines.
229
229
230
+
## Integrity Verification
231
+
232
+
The `integrity` command shows SHA256 hashes from lockfiles. Modern lockfiles include checksums: Gemfile.lock has a CHECKSUMS section, package-lock.json has integrity fields. These hashes verify that the exact package content matches what was originally resolved.
233
+
234
+
The `dependency_snapshots` table stores integrity alongside other dependency data. During `init` and `update`, bibliothecary extracts the integrity field from parsed lockfiles and git-pkgs stores it with each snapshot.
235
+
236
+
The `--drift` flag does two things:
237
+
238
+
1.**Internal drift** - detects when the same package@version has different integrity hashes across your history. This shouldn't happen under normal circumstances and could indicate:
239
+
- A dependency was republished with different content (rare but possible on some registries)
240
+
- A supply chain attack replaced a package
241
+
- Lockfile corruption or manual editing
242
+
243
+
2.**Registry mismatch** - compares lockfile hashes against the registry's published integrity via the ecosyste.ms API. A mismatch here is more serious: either your lockfile has been tampered with, or the registry itself has different content than what you resolved.
244
+
245
+
Internal drift queries the database for unique (purl, integrity) pairs and flags purls with multiple different values. Registry comparison fetches each version's integrity from ecosyste.ms (using the purl gem's `ecosystems_version_api_url` method) and compares against the lockfile value.
246
+
247
+
Unlike the `outdated` and `licenses` commands which are entirely extrinsic, integrity verification is primarily intrinsic (lockfile hashes come from your git history) with optional extrinsic comparison when using `--drift`.
248
+
230
249
## Models
231
250
232
251
Sequel models live in [`lib/git/pkgs/models/`](../lib/git/pkgs/models/). They're straightforward except for a few convenience methods:
0 commit comments