mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Redact env vars for Galaxy token or password
This commit is contained in:
@@ -64,7 +64,7 @@ def build_safe_env(env):
|
|||||||
for k, v in safe_env.items():
|
for k, v in safe_env.items():
|
||||||
if k == 'AWS_ACCESS_KEY_ID':
|
if k == 'AWS_ACCESS_KEY_ID':
|
||||||
continue
|
continue
|
||||||
elif k.startswith('ANSIBLE_') and not k.startswith('ANSIBLE_NET'):
|
elif k.startswith('ANSIBLE_') and not k.startswith('ANSIBLE_NET') and not k.startswith('ANSIBLE_GALAXY_SERVER'):
|
||||||
continue
|
continue
|
||||||
elif hidden_re.search(k):
|
elif hidden_re.search(k):
|
||||||
safe_env[k] = HIDDEN_PASSWORD
|
safe_env[k] = HIDDEN_PASSWORD
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ def test_send_notifications_list(mock_notifications_filter, mock_job_get, mocker
|
|||||||
('VMWARE_PASSWORD', 'SECRET'),
|
('VMWARE_PASSWORD', 'SECRET'),
|
||||||
('API_SECRET', 'SECRET'),
|
('API_SECRET', 'SECRET'),
|
||||||
('CALLBACK_CONNECTION', 'amqp://tower:password@localhost:5672/tower'),
|
('CALLBACK_CONNECTION', 'amqp://tower:password@localhost:5672/tower'),
|
||||||
|
('ANSIBLE_GALAXY_SERVER_PRIMARY_GALAXY_PASSWORD', 'SECRET'),
|
||||||
|
('ANSIBLE_GALAXY_SERVER_PRIMARY_GALAXY_TOKEN', 'SECRET'),
|
||||||
])
|
])
|
||||||
def test_safe_env_filtering(key, value):
|
def test_safe_env_filtering(key, value):
|
||||||
assert build_safe_env({key: value})[key] == tasks.HIDDEN_PASSWORD
|
assert build_safe_env({key: value})[key] == tasks.HIDDEN_PASSWORD
|
||||||
|
|||||||
Reference in New Issue
Block a user