mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-03 21:31:56 -05:00
validate galaxy server settings
involves some changes to the redact code
This commit is contained in:
@@ -15,7 +15,7 @@ class UriCleaner(object):
|
||||
if settings.PRIVATE_GALAXY_URL:
|
||||
exclude_list = (settings.PUBLIC_GALAXY_URL, settings.PRIVATE_GALAXY_URL)
|
||||
else:
|
||||
exclude_list = (settings.PUBLIC_GALAXY_URL)
|
||||
exclude_list = (settings.PUBLIC_GALAXY_URL,)
|
||||
redactedtext = cleartext
|
||||
text_index = 0
|
||||
while True:
|
||||
@@ -25,7 +25,7 @@ class UriCleaner(object):
|
||||
uri_str = match.group(1)
|
||||
# Do not redact items from the exclude list
|
||||
if any(uri_str.startswith(exclude_uri) for exclude_uri in exclude_list):
|
||||
text_index = match.start() + len(UriCleaner.REPLACE_STR)
|
||||
text_index = match.start() + len(uri_str)
|
||||
continue
|
||||
try:
|
||||
# May raise a ValueError if invalid URI for one reason or another
|
||||
@@ -62,7 +62,6 @@ class UriCleaner(object):
|
||||
redactedtext = t
|
||||
if text_index >= len(redactedtext):
|
||||
text_index = len(redactedtext) - 1
|
||||
print('URL string old: {} new: {}'.format(uri_str_old, uri_str))
|
||||
except ValueError:
|
||||
# Invalid URI, redact the whole URI to be safe
|
||||
redactedtext = redactedtext[:match.start()] + UriCleaner.REPLACE_STR + redactedtext[match.end():]
|
||||
|
||||
Reference in New Issue
Block a user