MCPcopy Create free account
hub / github.com/aws/aws-cli / _validate_allowed_url

Method _validate_allowed_url

awscli/botocore/utils.py:2918–2930  ·  view source on GitHub ↗
(self, full_url)

Source from the content-addressed store, hash-verified

2916 return self._retrieve_credentials(full_url, headers)
2917
2918 def _validate_allowed_url(self, full_url):
2919 parsed = botocore.compat.urlparse(full_url)
2920
2921 if parsed.scheme == 'https':
2922 return
2923 if self._is_loopback_address(parsed.hostname):
2924 return
2925 is_whitelisted_host = self._check_if_whitelisted_host(parsed.hostname)
2926 if not is_whitelisted_host:
2927 raise ValueError(
2928 f"Unsupported host '{parsed.hostname}'. Can only retrieve metadata "
2929 f"from a loopback address or one of these hosts: {', '.join(self._ALLOWED_HOSTS)}"
2930 )
2931
2932 def _is_loopback_address(self, hostname):
2933 try:

Callers 1

retrieve_full_uriMethod · 0.95

Calls 2

_is_loopback_addressMethod · 0.95

Tested by

no test coverage detected