fixing validation

This commit is contained in:
alwaysjolley 2019-04-22 09:38:44 -04:00
parent 8dccaaf544
commit f9dadb2670
1 changed files with 8 additions and 3 deletions

View File

@ -124,11 +124,16 @@ class VaultDestinationPlugin(DestinationPlugin):
san_list = get_san_list(body) san_list = get_san_list(body)
if san_filter: if san_filter:
for san in san_list: for san in san_list:
if not re.match(san_filter, san, flags=re.IGNORECASE): try:
if not re.match(san_filter, san, flags=re.IGNORECASE):
current_app.logger.exception(
"Exception uploading secret to vault: invalid SAN: {}".format(san),
exc_info=True)
os._exit(1)
except re.error:
current_app.logger.exception( current_app.logger.exception(
"Exception uploading secret to vault: invalid SAN: {}".format(san), "Exception compiling regex filter: invalid filter",
exc_info=True) exc_info=True)
os._exit(1)
with open(token_file, 'r') as file: with open(token_file, 'r') as file:
token = file.readline().rstrip('\n') token = file.readline().rstrip('\n')