Add a WIP flag for age rule work

What does this MR do?

Adds a wip feature flag, dependency_firewall_age_rule, and moves the age rule gate onto it. Package version rules were gated the same way with dependency_firewall_package_version.

  • Availability.age_rule_enabled? checks the flag against the top-level group, like the other dependency firewall predicates.
  • Security::Policy.skip_unsupported_rule? skips age rules unless the flag is on. It checked dependency_firewall_phase2 before.

This is the first of a series. Later merge requests remove dependency_firewall_phase2 and dependency_firewall_phase1 in favour of dependency_firewall_access, as part of https://gitlab.com/gitlab-org/gitlab/-/work_items/635888. Giving the age rule its own gate first means those removals do not have to carry it.

Runtime effect

None today. age is not in the DependencyFirewallPolicyRule type enum yet, so skip_unsupported_rule? returns before it reaches the flag check, whichever way the flag is set. This puts the gate in place before the rule becomes real. The rest of the Package Age work in https://gitlab.com/groups/gitlab-org/-/work_items/23744 gates itself on Availability.age_rule_enabled? as it lands, and the last item removes the flag.

Rollout

None needed. It is a wip flag, default off, and nothing user-visible depends on it yet. Once age joins the enum, a group that has dependency_firewall_phase2 on but not this flag will no longer get age rules.

How to verify

  • ee/spec/lib/security/dependency_firewall/availability_spec.rb covers the flag off, on for the top-level group, on only for a subgroup, and the nil container.
  • ee/spec/models/security/policy_spec.rb covers the age branch of skip_unsupported_rule? with the flag on and off.
  • spec/lib/feature/definition_spec.rb validates the flag definition.

Closes https://gitlab.com/gitlab-org/gitlab/-/work_items/637125

Merge request reports

Loading
Loading