Fix for group transfer service to deny transferring a group to its subgroup
What does this MR do?
Attempt to transfer a group to one of its sub-group results in an exception:
Errno::EINVAL (Invalid argument @ rb_file_s_rename - (/opt/gitlab/embedded/service/gitlab-rails/public/uploads/group-1, /opt/gitlab/embedded/service/gi
tlab-rails/public/uploads/group-1/sub-group-1/group-1))
The issue occurs because as part of the transfer, group directories are moved to its new parent
directory. In case of attempt to transfer a group to one of its sub-group, this move
is not possible at filesystem level hence FileUtils.move
raises exception.
The issue can be reproduced by following steps:
- Create a group -
Group-1
- Create a sub-group under
Group-1
namedGroup-2
- Transfer
Group-1
toGroup-2
This MR fixes the bug by introducing a constraint preventing transfer of a group to one of it's sub-group.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Ash McKenzie