fix(general): tolerate ${HTTPS_PROXY} without a scheme #6235
+19
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
urllib3.ProxyManager
is quite opinionated about the value passed in as the proxy URL, in that it must at least have a scheme. Creating aProxyManager
with a schemeless URL throws an exception:Checkov passes the value of
os.environ['https_proxy']
directly intoProxyManager
in platform_integration.py so if this value happens to not start with http:// or https://, then checkov crashes out.I couldn't find anything authoritative on whether
${HTTPS_PROXY}
should or shouldn't have a scheme. The best reference I could find was from the curl manual (https://curl.se/docs/manpage.html) which shows the "protocol" part as being optional.Given that it then seems valid for
${HTTPS_PROXY}
to contain a bare hostname (or host:port) pair, and it's certainly true in my environment, this patch checks to see if a scheme is present in the env var and then adds in a default if its absent.Checklist: