Skip to content

Update ImportExportUploader workhorse_local_upload_path

George Koltsov requested to merge georgekoltsov/fix-import-export-uploader into master

What does this MR do?

Currently Group Import API does not work on packaged installations due to ImportExportUploader.workhorse_local_upload_path returning /public/tmp/uploads directory to workhorse, when uploading a Group Export archive.

==> /var/log/gitlab/gitlab-workhorse/current <==
{"correlation_id":"hrkzWeU67Y5","error":"handleFileUploads: extract files from multipart: persisting multipart file: uploadLocalFile: mkdir \"/opt/gitlab/embedded/service/gitlab-rails/public/tmp/uploads\": mkdir /opt/gitlab/embedded/service/gitlab-rails/public/tmp: permission denied","level":"error","method":"POST","msg":"error","time":"2020-02-21T10:24:15Z","uri":"/api/v4/groups/import"}
{"correlation_id":"hrkzWeU67Y5","duration_ms":67,"host":"localhost","level":"info","method":"POST","msg":"access","proto":"HTTP/1.1","referrer":"","remote_addr":"127.0.0.1:0","remote_ip":"127.0.0.1","status":500,"system":"http","time":"2020-02-21T10:24:15Z","uri":"/api/v4/groups/import","user_agent":"curl/7.64.1","written_bytes":22} 

When workhorse tries to create such directory, it fails, because of lacking permissions. git user that is used there does not have any write permissions in this directory except to uploads dir, which is a symlink to a gitlab/uploads folder.

We should be uploading tmp file uploads to /public/uploads/tmp/uploads instead.

This MR changes workhorse_local_upload_path to include uploads in the returned path. This is similar to what FileUploader has for it's workhorse local upload path.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 George Koltsov

Merge request reports

Loading