Route group policy store writes through the GraphQL mutations

What does this MR do and why?

Summary

Group-level policies now go through the same GraphQL API as organization-level policies, instead of using a separate REST API. Previously, creating, updating, or deleting a policy for a group would call a different backend endpoint than for an organization. Now, a single unified path handles both — the code simply passes a groupPath for groups or an organizationId for organizations, and the server knows which one to use.

A safety guard was also added: if a caller accidentally includes a container argument (like groupPath or organizationId) in the policy parameters themselves, the code will immediately reject the request with a clear error, preventing any ambiguity about which container the policy belongs to.

Tests were updated to reflect this consolidation — REST API mocks were removed, and new tests confirm that the correct container argument is sent for each namespace type.

References

Screenshots or screen recordings

Description UI
Group path for a group level call Screenshot 2026-09-29 at 00.11.32.png

How to set up and validate locally

The feature is behind the security_policies_v2 flag (default off). Policy store pages live at /groups/<group-path>/-/security/policy_store and /organizations/<org-path>/-/security/policy_store.

  1. Enable the flag in the rails console: Feature.enable(:security_policies_v2).
  2. Make sure the policy store experiment is active for a top-level group.
  3. Open the group's policy store list and create a policy through the wizard.
  4. Edit the policy and toggle its status from the detail page.
  5. Delete the policy.
  6. Check the browser network tab: requests are governPolicyCreate, governPolicyUpdate, governPolicyDelete GraphQL calls carrying groupPath, and there are no requests to /api/v4/groups/:id/security/policy_store.
  7. Try creating a second policy with the same name and confirm the error appears inline under the name field.
  8. Repeat one write on an organization page and confirm the request carries organizationId and no groupPath.

Locally, jest ee/spec/frontend/policy_store passed (32 suites, 622 tests). The three mutation documents were also validated against a freshly dumped GraphQL schema.

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.

Edited by Artur Fedorov

Merge request reports

Loading
Loading