Fix dependency firewall drawer showing license text for all rule types
Summary
The Dependency Firewall policy drawer always showed a license-specific rule summary, no matter which rule type the policy actually used. A policy built with a malicious-package, risk-severity, or vulnerability rule showed the wrong summary text and tried to render license-shaped data that did not exist on those rules.
This extracts a utils.js for the drawer, following the pattern already used by the scan_result and scan_execution policy drawers: a humanizeRule function that branches on rule.type and returns the correct summary text and criteria shape per type, with details_drawer.vue rendering whatever it returns instead of assuming license shape.
While rewriting this logic, a max-effort review surfaced and this MR also fixes several related defects:
- A truthy-only emptiness check that could render an empty deny/allow list.
- An unguarded exceptions map that threw on an explicit
nullexceptions key (reachable via hand-edited or legacy YAML). - An unhandled
agerule type (already valid per the JSON schema, not yet supported here) and anullrule.type that would otherwise silently fall through to the wrong rendering. - Risk-severity and vulnerability rules that dropped their configured exceptions from the summary entirely.
- Risk-severity wording that said a threshold is denied "or higher" when the backend only denies counts strictly greater than it.
- A vulnerability rule that showed identical text for allow and deny configurations.
- Rule keys that were not unique enough to stop Vue from reusing a rendered rule's component instance (with its own accordion-expand state) across unrelated policies.
Resolves https://gitlab.com/gitlab-org/gitlab/-/work_items/629043
| Before | After | Description |
|---|---|---|
![]() |
![]() |
Risk Severity Rule |
![]() |
![]() |
Malware Rule |
![]() |
![]() |
Licenses Rule (Unchanged) |
Test plan
-
yarn jest ee/spec/frontend/security_orchestration/components/policy_drawer/dependency_firewall/— 88 tests passing -
yarn jest ee/spec/frontend/security_orchestration/components/policy_drawer/drawer_wrapper_spec.js— passing, confirms the drawer still mounts correctly from the policy-type dispatcher - ESLint / Prettier clean on all changed files
- Manual review of each rule type's rendered summary text (license, malicious, risk_severity, vulnerability, and an unrecognized type)





