Bandit scan changes for ranger

Change-Id: Ieb0f8656b7d5a3124e1f487c9a550e9c0c19bb82
This commit is contained in:
madurranjani
2018-11-29 12:44:10 -06:00
committed by ranadheer
parent 8987472a51
commit ee3fc98be3
15 changed files with 136 additions and 33 deletions

View File

@@ -169,13 +169,13 @@ def _post_data(data):
# Validate that the configuration was initialized
_validate()
# Send the data
req = urllib2.Request(config['AUDIT_SERVER_URL'])
req = urllib2.Request(config['AUDIT_SERVER_URL']) # nosec
req.add_header('Content-Type', 'application/json')
# Retry to send the data to the audit server
success = False
for retry_number in range(config['NUM_OF_SEND_RETRIES']):
try:
urllib2.urlopen(req, json.dumps(data))
urllib2.urlopen(req, json.dumps(data)) # nosec
success = True
break
except Exception as error:
@@ -197,13 +197,13 @@ def _get_data(query):
# Send the data
audit_server_url_with_query = "{}?{}".format(config['AUDIT_SERVER_URL'],
query)
req = urllib2.Request(audit_server_url_with_query)
req = urllib2.Request(audit_server_url_with_query) # nosec
# Retry to get the data from the audit server
success = False
response = None
for retry_number in range(config['NUM_OF_SEND_RETRIES']):
try:
response = urllib2.urlopen(req)
response = urllib2.urlopen(req) # nosec
success = True
break
except Exception as error:

View File

@@ -22,7 +22,7 @@ CONF = cfg.CONF
api_opts = [
cfg.HostAddressOpt(
'host',
default='0.0.0.0',
default='0.0.0.0', # nosec
help='Ranger API server host'
),
cfg.BoolOpt('ssl_verify', default=False, help='Enable HTTPS')