Incorrect error returned when reapplying security policy
Summary
To address #416903 (closed), we implemented an error response when attempting to assign a security policy that is already being inherited from a parent group.
This error is also returned if you attempt to assign a policy to a project that is already has the same policy applied directly to it (not inherited).
Steps to reproduce
- Create a project, and a policy within
.gitlab/security-policies/policy.yml
. - Create another project to apply this project to. Ensure no policies are currently applied at any group level.
- Execute the following mutation twice. The first execution will result in the policy being applied to the project. The second will return the group inheritance error.
mutation {
securityPolicyProjectAssign (
input: {
securityPolicyProjectId: "gid://gitlab/Project/YOUR_PROJECT_ID",
fullPath: "path/to/target/project"
})
{
errors
}
}
Error returned after second execution:
"errors": [
"You don't need to link the security policy projects from the group. All policies in the security policy projects are inherited already."
]
What is the current bug behavior?
Group inheritance error is returned when attempting to reapply an existing project level policy that is not inherited.
What is the expected correct behavior?
Group inheritance error is not returned when attempting to reapply an existing project level policy that is not inherited.
Output of checks
This bug happens on GitLab.com