Skip to content

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.

for i in image_names_to_query
])
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jumiles-pa
Why are we hardcoding the log level to DEBUG?
The log level should be injected from an external configuration.

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.

2 participants