Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if acct_number_match:
self._from_account_number(input)
return
aws_service_match = re.search('^(([^.]+)(.[^.]+)?)\.amazon(aws)?\.com$', input)
if aws_service_match:
self._from_aws_service(input, aws_service_match.group(1))
return
aws_service_match = re.search('^([^.]+).aws.internal$', input)
if aws_service_match:
self._from_aws_service(input, aws_service_match.group(1))
return
self.error = True
logger.warning('ARN Could not parse [{}].'.format(input))
def _arn_internet_accessible(self, arn_input):
if '*' == arn_input:
return True
arn = ARN(arn_input)
if arn.error:
logger.warning('Auditor could not parse ARN {arn}.'.format(arn=arn_input))
return '*' in arn_input
if arn.tech == 's3':
# S3 ARNs typically don't have account numbers.
return False
if not arn.account_number and not arn.service:
logger.warning('Auditor could not parse Account Number from ARN {arn}.'.format(arn=arn_input))
return True
if arn.account_number == '*':
return True
return False
def _arn_internet_accessible(self, arn_input):
if '*' == arn_input:
return True
arn = ARN(arn_input)
if arn.error:
logger.warning('Auditor could not parse ARN {arn}.'.format(arn=arn_input))
return '*' in arn_input
if arn.tech == 's3':
# S3 ARNs typically don't have account numbers.
return False
if not arn.account_number and not arn.service:
logger.warning('Auditor could not parse Account Number from ARN {arn}.'.format(arn=arn_input))
return True
if arn.account_number == '*':
return True
return False