Skip to content

fix(general): Proxy ignored when pulling image data #7230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jumiles-pa
Copy link

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

checkov/common/images/image_referencer.py:_fetch_image_results_async() uses the Aiohttp library which documents that the environment variables will not be used unless trust_env is set to True. This breaks scans when and proxy is in use through environment variables which is documented in Checkov to be supported.

Fixes # (issue)
The fix is to add trust_env=True to the two spots that instantiate ClientSession objects. To test this please search for the fail logs in the function referred to in description when scans should be blocked by a proxy for the image result and license calls.

Please note that this will read all environment variables for these specific calls so may have unrelated impact. Other portions of the tool properly use proxy settings and the error that lead to this discovery was finding a different number of findings than others without a proxy.

https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

@jumiles-pa
Copy link
Author

My intention is to remove extra logging once I'm able to test this more thoroughly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant