fetch2/git.py: Added handling of the user's password in url
PATCH 1/1 fetch2/git.py: Added handling of the user's password in url
Fetching source code from private repository (using https or http) fails because password passed in url (git://user:pass@domain) is ignored.
--- lib/bb/fetch2/git.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
lib/bb/fetch2/git.py +6 -3
@@ -527,10 +527,13 @@ class Git(FetchMethod): Return the repository URL """ if ud.user: - username = ud.user + '@' + if ud.pswd: + userinfo = ud.user + ':' + ud.pswd '@' + else: + userinfo = ud.user + '@' else: - username = "" - return "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path) + userinfo = "" + return "%s://%s%s%s" % (ud.proto, userinfo, ud.host, ud.path) def _revision_key(self, ud, d, name): """
Signature · 1 line
2.7.4
Quoted 2 lines · Jakub Dębski
Fetching source code from private repository (using https or http) fails because password passed in url (
git://user:pass@domain) is ignored.
Maybe this is by design to prevent credentials leaking into bitbake recipes.
Alternative is to set the usernames, passwords etc in e.g. ~/.netrc and ~/.ssh/config files which have the same effect.
-Mikko
Quoted 7 lines
Maybe this is by design to prevent credentials leaking into bitbake recipes.
Alternative is to set the usernames, passwords etc in e.g. ~/.netrc and ~/.ssh/config files which have the same effect.
-Mikko
Certainly, credentials could be set in other ways, but there is some inconsistency with other fetchers (e.g. perforce, wget, hg) which use password from SRC_URI.
--
Jakub Dębski
Quoted 11 lines · Jakub Dębski
Quoted 7 lines
Maybe this is by design to prevent credentials leaking into bitbake recipes.
Alternative is to set the usernames, passwords etc in e.g. ~/.netrc and ~/.ssh/config files which have the same effect.
-Mikko
Certainly, credentials could be set in other ways, but there is some inconsistency with other fetchers (e.g. perforce, wget, hg) which use password from
SRC_URI.
that merits an entry in bugzilla
Quoted 9 lines · On 4/12/18 5:16 AM, [email protected] wrote:
Quoted 2 lines · Jakub Dębski
Fetching source code from private repository (using https or http) fails because password passed in url (
git://user:pass@domain) is ignored.Maybe this is by design to prevent credentials leaking into bitbake recipes.
Alternative is to set the usernames, passwords etc in e.g. ~/.netrc and ~/.ssh/config files which have the same effect.
Yes, this has come up a few times in the past, and it's been rejected -- as we don't want credentials to end up in bitbake. (Way too easy to accidentally leak them to others.)
--Mark
Quoted 2 lines
-Mikko
Quoted 3 lines · Jakub Dębski
Fetching source code from private repository (using https or http) fails because password passed in url (
git://user:pass@domain) is ignored.
this is a security issue since SRC_URIs get into the package metadata
infact a patch to detect this case and warn/error about it will be better. You might want to use .netrc to specify the credentials.
Quoted 27 lines
Signed-off-by Jakub Dębski <[email protected]>--- lib/bb/fetch2/git.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)lib/bb/fetch2/git.py +6
-3@@ -527,10 +527,13 @@ class Git(FetchMethod): Return the repository URL """ if ud.user: - username = ud.user + '@' + if ud.pswd: + userinfo = ud.user + ':' + ud.pswd '@' + else: + userinfo = ud.user + '@' else: - username = "" - return "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path) + userinfo = "" + return "%s://%s%s%s" % (ud.proto, userinfo, ud.host, ud.path) def _revision_key(self, ud, d, name): """