Redesign the dependency firewall dashboard with prevented package stats
What does this MR do and why?
Redesigns the project dependency firewall dashboard, behind the dependency_firewall_dashboard_v2 feature flag (beta, default off). Group pages keep the current dashboard until group stats are available.
This work was started by Hannah Baker; taking it over while she is on PTO.
The new dashboard shows four metric cards:
- Package evaluations, with blocked and warned counts.
- Vulnerabilities prevented, with Critical and High counts. Only these two are listed so the breakdown fits on one line; the card total counts every severity.
- Malicious packages prevented, with a warned-only count.
- License risks prevented, with a warned-only count.
The prevented counts come from the GraphQL fields added in !253947 (merged). Null values show as 0, and the six fields use @gl_introduced(version: "19.5.0").
The active policies table uses real data from dependencyFirewallRuleActivity, with one row per enabled policy, since the API returns one row per rule. Source and Scope reuse the security policies list's wording and scope component, so a project shows "This project" for Scope, as the policies list does.
A time window selector lets users switch between the last 7 or 30 days, defaulting to 30.
The current dashboard moves to dashboard_v1_* components and queries, to be removed together with the feature flag.
Screenshots or screen recordings
Both screenshots are of a project page in a local GDK with sample data.
How to set up and validate locally
- In
bin/rails console, enable both flags on the project's top-level group:group = Group.find_by_full_path('<top-level group path>') Feature.enable(:dependency_firewall_phase1, group) Feature.enable(:dependency_firewall_dashboard_v2, group) - Optionally add a prevented package so a card shows a count:
Security::DependencyFirewallPreventedPackage.create!(project: Project.find_by_full_path('<project path>'), rule_type: :vulnerability, severity: :critical, identifier: 'pkg:npm/lodash@4.17.20', first_seen_at: 1.day.ago, last_blocked_at: 1.day.ago) - Open the project's Secure > Dependency firewall page: the new dashboard shows, with the policies that apply to the project.
- Open the group's Secure > Dependency firewall page: the current dashboard shows.
- Disable
dependency_firewall_dashboard_v2and reload the project page: the current dashboard shows. - Specs:
yarn jest ee/spec/frontend/dependency_firewall
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
References
- Work item: https://gitlab.com/gitlab-org/gitlab/-/work_items/627538
- Backend GraphQL fields: !253947 (merged)
- Feature flag rollout: #631486 (closed)

