-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
platform(general): Get resources from platform and filter taggable resources for policies #3621
Conversation
…esources (not all)
I am in typing hell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, had some comments
checkov/common/bridgecrew/integration_features/features/attribute_resource_types_integration.py
Outdated
Show resolved
Hide resolved
checkov/common/bridgecrew/integration_features/features/attribute_resource_types_integration.py
Outdated
Show resolved
Hide resolved
checkov/common/bridgecrew/integration_features/features/attribute_resource_types_integration.py
Show resolved
Hide resolved
checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py
Outdated
Show resolved
Hide resolved
@gruebel @nimrodkor @rotemavni added you to sanity check whether this can be safely merged. I ran some tests against prod (where the platform changes do not exist) and it seems to work fine in checkov. And I don't think anything here will break a platform scan in the checkov wrapper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, great work. The only question I had, you already answered in the description 🥇
…sources for policies (#3621) * get attributes from the platform that should be applied to specific resources (not all) * use a set for the taggable resource types * add test of full policy scan * fix tests * remove local resource types * cleanup comments and code * remove unused imports * fix mypy? * fix mypy! * make resource types list or set * make resource types list or set * change resource types to set * resource types as list * handle custom policies injected by platform * save provider to resource mapping * add abstract method shells * mypy * add unique orders for integrations * resolve review comments * fix test
…sources for policies (#3621) * get attributes from the platform that should be applied to specific resources (not all) * use a set for the taggable resource types * add test of full policy scan * fix tests * remove local resource types * cleanup comments and code * remove unused imports * fix mypy? * fix mypy! * make resource types list or set * make resource types list or set * change resource types to set * resource types as list * handle custom policies injected by platform * save provider to resource mapping * add abstract method shells * mypy * add unique orders for integrations * resolve review comments * fix test
…sources for policies (#3621) * get attributes from the platform that should be applied to specific resources (not all) * use a set for the taggable resource types * add test of full policy scan * fix tests * remove local resource types * cleanup comments and code * remove unused imports * fix mypy? * fix mypy! * make resource types list or set * make resource types list or set * change resource types to set * resource types as list * handle custom policies injected by platform * save provider to resource mapping * add abstract method shells * mypy * add unique orders for integrations * resolve review comments * fix test
…sources for policies (#3621) * get attributes from the platform that should be applied to specific resources (not all) * use a set for the taggable resource types * add test of full policy scan * fix tests * remove local resource types * cleanup comments and code * remove unused imports * fix mypy? * fix mypy! * make resource types list or set * make resource types list or set * change resource types to set * resource types as list * handle custom policies injected by platform * save provider to resource mapping * add abstract method shells * mypy * add unique orders for integrations * resolve review comments * fix test
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
So, for example, if you have a platform policy with provider
aws
and a condition that checkstags
with resource typesall
, then the check will only apply to taggable AWS Terraform resources. If you use the attributeTags.*.Key
, then it will only apply to CloudFormation.If you have a Checkov policy that uses
all
with the attributetags
, then it will apply it to AWS, Azure, and Ali (because checkov policies do not have a provider in the spec).This also removes the local list of resource types from checkov, which was pretty much totally dead code in reality, because platform custom policies didn't even have the provider in the API response.
Requires some platform changes (some done, some in progress) before this can be 100% safely merged (but it should still work)
Checklist: