Policy scope is incorrect in the policy list for inherited policies

Summary

Group-level policies show the incorrect scope in child projects that they are not scoped to

Steps to reproduce

  1. Upload a GitLab Ultimate license
  2. Navigate to a group with projects => Secure => Policies => New policy
  3. Create a policy of any type and scope it to one child project
  4. Navigate to a project in the group that the policy was not scoped to => Secure => Policies

Example Project

https://staging.gitlab.com/govern-team-test/alexander-test-group/rails-application/-/security/policies

What is the current bug behavior?

Group policies that are not scoped to the project, show up in the project's policy list/drawer as "This project"

What is the expected correct behavior?

Group policies that are not scoped to the project, show up in the project's policy list/drawer as showing the projects they are scoped to

Relevant logs and/or screenshots

Scenario Screenshot
Group policy group_policy
Project the policy is scoped to project_scoped
Project the policy is not scoped to project_not_scoped_to

Possible fixes

We could

  1. Update the wording to say it is not scoped to this project
  2. Filter out policies that do not apply to non-scoped projects

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by Alexander Turinske