Bitbucket remote password is stored in clear text when importing poject

Summary

Bitbucket remote URL connection string includes username and password in cleartext in the config file of the git repository

Steps to reproduce

  • Click on [+] in the meny
  • Select Create a project
  • Choose import project
  • Select Bitbucket Server
  • [Choose project]
  • Import
  • Access the gitlab server
  • cd to /opt/gitlab/data/git-data/repositories/{group}/{project}.git
  • cat the config file

===> The config looks like this

[core]
	bare = true
	repositoryformatversion = 0
	filemode = true
[remote "bitbucket_server"]
	url = https:[user]:[url encoded password in clear text]@bitbucket.my-company.internal/scm/my-repo/my-project.git
	fetch = +refs/heads/*:refs/heads/*
	fetch = +refs/tags/*:refs/tags/*
	fetch = +refs/pull-requests/*/to:refs/merge-requests/*/head
	mirror = true
	prune = true

Example Project

Fro obvious reasons, I am not going to provide a public repo with my cleartext password

What is the current bug behavior?

config file is created with actual clear text credentials

What is the expected correct behavior?

config file created should not contain cleartext password

Relevant logs and/or screenshots

Output of checks

I can not see if it works on gitlab com, I haven't got access to the source folders there

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.3 Go Version: unknown

GitLab information Version: 11.7.0-ee Revision: c02f0d4 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.11 URL: http://gitlab.mrgreen.tech HTTP Clone URL: http://gitlab.mrgreen.tech/some-group/some-project.git SSH Clone URL: git@gitlab.mrgreen.tech:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 8.4.4 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 8.4.4 ? ... OK (8.4.4) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain ..... 100 FIRST LDAP ACCOUNTS HERE ..... LDAP authentication... Success Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 4/1 ... yes 4/2 ... yes 3/3 ... yes 5/4 ... yes 8/5 ... yes 20/6 ... yes 12/7 ... yes 12/8 ... yes 11/9 ... yes 19/11 ... yes 17/12 ... yes 11/13 ... yes 12/14 ... yes 22/15 ... yes 22/16 ... yes 22/17 ... yes 22/18 ... yes 22/19 ... yes 4/20 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 11 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Edited by 🤖 GitLab Bot 🤖