mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 09:57:35 -02:30
revert change made to allow UI to accept x-access-token, just use htt… (#15851)
revert change made to allow UI to accept x-access-token, just use https:// instead
This commit is contained in:
committed by
GitHub
parent
fa099fe737
commit
70ea0a785b
@@ -247,7 +247,7 @@ def test_extract_ansible_vars():
|
|||||||
True,
|
True,
|
||||||
True,
|
True,
|
||||||
False,
|
False,
|
||||||
ValueError('Username must be "git" or "x-access-token" (for github app) for SSH access to github.com.'),
|
ValueError('Username must be "git" for SSH access to github.com.'),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'git',
|
'git',
|
||||||
@@ -256,7 +256,7 @@ def test_extract_ansible_vars():
|
|||||||
True,
|
True,
|
||||||
True,
|
True,
|
||||||
False,
|
False,
|
||||||
ValueError('Username must be "git" or "x-access-token" (for github app) for SSH access to bitbucket.org.'),
|
ValueError('Username must be "git" for SSH access to bitbucket.org.'),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'git',
|
'git',
|
||||||
@@ -265,7 +265,7 @@ def test_extract_ansible_vars():
|
|||||||
True,
|
True,
|
||||||
True,
|
True,
|
||||||
False,
|
False,
|
||||||
ValueError('Username must be "git" or "x-access-token" (for github app) for SSH access to altssh.bitbucket.org.'),
|
ValueError('Username must be "git" for SSH access to altssh.bitbucket.org.'),
|
||||||
),
|
),
|
||||||
('git', 'git:password@github.com:ansible/awx.git', True, True, True, False, 'git+ssh://git@github.com/ansible/awx.git'),
|
('git', 'git:password@github.com:ansible/awx.git', True, True, True, False, 'git+ssh://git@github.com/ansible/awx.git'),
|
||||||
# Disabling the special handling should not raise an error
|
# Disabling the special handling should not raise an error
|
||||||
|
|||||||
@@ -329,19 +329,12 @@ def update_scm_url(scm_type, url, username=True, password=True, check_special_ca
|
|||||||
|
|
||||||
# Special handling for github/bitbucket SSH URLs.
|
# Special handling for github/bitbucket SSH URLs.
|
||||||
if check_special_cases:
|
if check_special_cases:
|
||||||
special_hosts = ('github.com', 'bitbucket.org', 'altssh.bitbucket.org')
|
special_git_hosts = ('github.com', 'bitbucket.org', 'altssh.bitbucket.org')
|
||||||
allowed_git_usernames = {'git', 'x-access-token'}
|
if scm_type == 'git' and parts.scheme.endswith('ssh') and parts.hostname in special_git_hosts and netloc_username != 'git':
|
||||||
|
raise ValueError(_('Username must be "git" for SSH access to %s.') % parts.hostname)
|
||||||
if scm_type == 'git' and parts.scheme.endswith('ssh'):
|
if scm_type == 'git' and parts.scheme.endswith('ssh') and parts.hostname in special_git_hosts and netloc_password:
|
||||||
is_github_host = parts.hostname in special_hosts or parts.hostname.endswith('.github.com')
|
# raise ValueError('Password not allowed for SSH access to %s.' % parts.hostname)
|
||||||
is_bitbucket_host = parts.hostname in special_hosts or parts.hostname.endswith('.bitbucket.com') or 'bitbucket' in parts.hostname
|
netloc_password = ''
|
||||||
|
|
||||||
if is_github_host and netloc_username not in allowed_git_usernames:
|
|
||||||
raise ValueError(_('Username must be "git" or "x-access-token" (for github app) for SSH access to %s.') % parts.hostname)
|
|
||||||
|
|
||||||
if (is_github_host or is_bitbucket_host) and netloc_password:
|
|
||||||
# raise ValueError('Password not allowed for SSH access to %s.' % parts.hostname)
|
|
||||||
netloc_password = ''
|
|
||||||
|
|
||||||
if netloc_username and parts.scheme != 'file' and scm_type not in ("insights", "archive"):
|
if netloc_username and parts.scheme != 'file' and scm_type not in ("insights", "archive"):
|
||||||
netloc = u':'.join([urllib.parse.quote(x, safe='') for x in (netloc_username, netloc_password) if x])
|
netloc = u':'.join([urllib.parse.quote(x, safe='') for x in (netloc_username, netloc_password) if x])
|
||||||
|
|||||||
Reference in New Issue
Block a user