Skip to content

Commit

Permalink
Refs #16881: Protect args.certs_path
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Feb 21, 2023
1 parent 3e1ac75 commit fc85255
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,18 @@ def get_configurations(config_params, intraprocess, shm, security):

if security is not None:
if os.path.isfile(config_params['properties']['SECURITY']):
props_file = open(config_params['properties']['SECURITY'], "r+")
data = props_file.read()
#Replace all occurrences of the required label
data = data.replace('<CERTS_RELATIVE_PATH>', args.certs_path)
props_file.seek(0)
props_file.write(data)
props_file.truncate()
props_file.close()
if os.path.isfile(args.certs_path):
props_file = open(config_params['properties']['SECURITY'], "r+")
data = props_file.read()
#Replace all occurrences of the required label
data = data.replace('<CERTS_RELATIVE_PATH>', args.certs_path)
props_file.seek(0)
props_file.write(data)
props_file.truncate()
props_file.close()
else:
logger.error('Certs file not found at ' + args.certs_path)
exit(1)
else:
logger.error('Properties file not found at ' + config_params['properties']['SECURITY'])
exit(1)
Expand Down

0 comments on commit fc85255

Please sign in to comment.