[go: up one dir, main page]

Skip to content

Add User on Import if required

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

While trying to import a project on behalf of a prospect/customer in https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/8383, we got this error: Unable to save project. Error: Error importing repository into project/path - Error adding importer user to project members. Validation failed: Source can't be blank

From what I can tell, it's because the user specified as the importer was not in the list of project members at the Maintainer level.

Further details

for more details, see https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/8383#note_245829470

Proposal

Auto add the user that is importing the project to the list of project members at the Maintainer level since they are "creating" the project.

Permissions and Security

Right now https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/import_export/members_mapper.rb#L52 throws the error if the user is not in the list of project members. It may be considered a security issue if you're auto-added, but with enough knowledge, a user could manually edit the json file to do so anyway.

Testing

What does success look like, and how can we measure that?

Error is not thrown, and project is imported.

Edited by 🤖 GitLab Bot 🤖