Repository navigation
🔎 ci: Submit bun.lock to GitHub's Dependency Graph So Dependabot Alerts Cover Every Installed Package - #217
Merged
Merged
Conversation
…ts Cover Every Installed Package GitHub's dependency graph reads package-lock.json, yarn.lock and pnpm-lock.yaml, not bun.lock. For this repository it saw only package.json: 72 entries, mostly version ranges, and none of the transitive packages, so Dependabot raised no alert for a vulnerable package the panel installs but doesn't list itself (a TanStack Start server package, say, which the panel only pins through `overrides`). A new Dependency Graph workflow submits bun.lock's resolved packages through GitHub's dependency submission API on every push to main that changes bun.lock, package.json or the submitter, and on demand. scripts/dependencies.ts builds the snapshot: every registry package once per exact version (815 today), `direct` when package.json lists it, and `runtime` when a runtime dependency reaches it, `development` otherwise. Nested copies resolve the way Node does, nearest node_modules first, and local file dependencies are left out. Dependabot alerts then cover submitted packages like any other.
Contributor
Author
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Hey og |
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.
Pull Request Template
Summary
Dependabot alerts here only ever covered what
package.jsonlists. GitHub's dependency graph readspackage-lock.json,yarn.lockandpnpm-lock.yaml, but notbun.lock(supported ecosystems). Before this PR, the repository's dependency graph held 72 entries, mostly version ranges taken frompackage.json(react ^19.3.1), and none of the roughly 750 transitive packagesbun.lockinstalls.@tanstack/start-server-coreis only pinned throughoverrides.minimatchadvisory (GHSA-g3hv-75wg-m249) thatbun auditreports never showed up as an alert either.The fix: submit
bun.lockthrough the dependency submission API. Dependabot alerts cover submitted packages like any others..github/workflows/dependency-graph.yml) builds a snapshot and posts it withgh api. It runs on every push tomainthat changesbun.lock,package.json, the script or the workflow, and on demand.contents: write, which the API requires.scripts/dependencies.tsreadsbun.lockwithBun.JSONCand prints the snapshot:directmeanspackage.jsonlists it.runtimemeans a runtime dependency reaches it, throughdependencies,optionalDependenciesorpeerDependencies; otherwise it'sdevelopment.@babel/core/semver) resolve the way Node does, nearestnode_modulesfirst.file:tools/…) has no registry version, so it's left out, but its edges still count toward scopes.resolveManifest,toSnapshot), tested in Vitest. The Bun-only part just reads the lockfile and prints.Change Type
Testing
scripts/dependencies.test.ts(8 tests) runs on a small lockfile with real entry shapes and checks:runtime;+in a version encoded in the package URL;On this repository's
bun.lock, the script resolves 815 packages:package.json's 63 minus the local plugin.react@19.3.1(direct, runtime),@tanstack/start-server-core@1.169.45(transitive, runtime), andminimatch@3.1.5and@10.2.6(transitive, development).I submitted the snapshot to this repository for this PR's branch. GitHub answered
ACCEPTED, and said a snapshot for a branch other than the default doesn't change the repository's results.npx tsc --noEmit(it coversscripts/) and Prettier pass, and the workflow parses as YAML.After this merges, I'll check that the workflow's first run on
mainis accepted, that the dependency graph grows from 72 entries to the lockfile's packages, and that Dependabot opens an alert for theminimatchadvisorybun auditalready reports.Checklist