Project owner is unable to link security policy project unless they are owner in the security policy project
Summary
It appears that `securityPolicyProjectAssign` mutation does not... (#416647 - closed) introduced a regression that requires users have owner
role in the security policy project they are linking.
A requirement for security policies is that the project owner of a project that is being enforced by the security policies should not have Owner/Maintainer access, as this would be a compliance issue as these users could potentially modify the policies enforced against them (at least without additional configuration). Read access should also not be required.
Steps to reproduce
- Create a test group
- Create a subgroup "Security Group"
- Create a project under this group "Security Policy Management"
- Create a policy within the project - this generates the security policy project "Security Policy Management - security policy project"
- Create a separate subgroup "Development Projects"
- Create a project within this "Project A"
- Add a new test user to the project and grant them owner permissions in Project A. They should have no other permissions.
- Attempt to link the security policy project.
- Observe it's not possible to search/find the project.
(here, I should see Haven / Security Group / Security Policy Management - security policy project
when searching)
- Or, alternatively, you may find it and be presented with an error.
Example Project
https://gitlab.com/haven-group
What is the current bug behavior?
Project owner is unable to link a security policy project.
What is the expected correct behavior?
Project owner should be able to link a security policy project.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:env:info\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:check SANITIZE=true`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`) (we will only investigate if the tests are passing)
Possible fixes
- Part 1 is completed. As of %16.6, users must have at least a Developer, Reporter, or Guest role in the security policy project + Owner role in the target development project to be able to link the project to the security policy project. - !135977 (merged).
- We'll need to backport this for the versions we can.
- We'll want to iterate on this approach to remove the requirement for users to be members in the security policy project they are linking at all, while ensuring access and visibility is properly restricted to only those who require it.