Skip to content

Comments

JOB-148890 Dependabot alerts leaking across pnpm workspaces#29

Merged
timoteialbu merged 1 commit intomasterfrom
fix/filter-dependabot-alerts-to-workspace-scope
Feb 17, 2026
Merged

JOB-148890 Dependabot alerts leaking across pnpm workspaces#29
timoteialbu merged 1 commit intomasterfrom
fix/filter-dependabot-alerts-to-workspace-scope

Conversation

@timoteialbu
Copy link
Contributor

Summary

  • Fixes a scope mismatch where Dependabot alerts fetched at repository level were being injected into every workspace's results, even when the vulnerable package doesn't belong to that workspace
  • Adds a filter_to_workspace_packages method that removes Dependabot-injected packages not present in the workspace's dependency tree (all_libraries from pnpm list)
  • Applied to both get_versions_for_workspace (per-workspace path) and get_versions (legacy single-package path)

Problem

When analyzing pnpm workspaces, the Dependabot API query (github.rb) fetches all NPM alerts for the entire repository. For a vulnerable package like @grpc/grpc-js that belongs to workspace X, the alert would also be injected into workspace Y's parsed_results. Since @grpc/grpc-js is not in workspace Y's dependency tree:

  1. No LibNode / dependency graph is created for it
  2. Transitive ownership can't walk any parent chain (graph is nil)
  3. The package falls through to attention_needed
  4. A false Slack notification is sent for a workspace that doesn't even use the package

Fix

After add_dependabot_findings runs, filter_to_workspace_packages compares parsed_results keys against all_libraries (the complete set of packages from pnpm list --depth=Infinity for that workspace). Any package not in all_libraries — meaning it was injected by Dependabot but doesn't exist in this workspace — is removed from parsed_results before the dependency graph and ownership passes run.

Test plan

  • Added 5 new RSpec tests for filter_to_workspace_packages:
    • Removes Dependabot-injected packages not in the workspace (core scenario with @grpc/grpc-js)
    • No-op when all packages belong to the workspace
    • Keeps vulnerable packages that are actually in the workspace
    • Handles empty parsed_results
    • Removes multiple injected packages from different workspaces
  • All 47 existing + new tests pass (bundle exec rspec spec/pnpm_spec.rb)
  • Run against jobber-frontend to verify @grpc/grpc-js no longer appears in packages/visualizations results
  • Verify @grpc/grpc-js still appears in whichever workspace actually depends on it

Made with Cursor

Dependabot alerts are fetched at repository scope (all NPM alerts for
the entire repo), but dependency graphs and ownership are resolved at
workspace scope. This caused vulnerable packages from other workspaces
to be injected into every workspace's results with no dependency graph
and no ownership path, resulting in false `attention_needed` notifications.

For example, `@grpc/grpc-js` (a dependency of a different workspace)
was showing up as `attention_needed` in `packages/visualizations` even
though it is not in that workspace's dependency tree at all.

The fix adds a `filter_to_workspace_packages` step after the Dependabot
pass that removes any packages not present in the workspace's known
dependency tree (`all_libraries` from `pnpm list`). This is applied in
both `get_versions_for_workspace` and `get_versions` code paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@timoteialbu timoteialbu changed the title Fix Dependabot alerts leaking across pnpm workspaces JOB-148890 Dependabot alerts leaking across pnpm workspaces Feb 17, 2026
@timoteialbu timoteialbu merged commit 29b4ad2 into master Feb 17, 2026
1 check passed
@timoteialbu timoteialbu deleted the fix/filter-dependabot-alerts-to-workspace-scope branch February 17, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants