-
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
feat(terraform): Added base class for cloudsplaining iam checks to be integrated between data and resource objects #4338
Conversation
7bbf027
to
a8e39e8
Compare
293248a
to
476ac4b
Compare
476ac4b
to
4fff87d
Compare
d8b3e88
to
94431a7
Compare
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.
in general, good job 💪
) | ||
|
||
|
||
class BaseTerraformCloudsplainingDataIAMCheck(BaseDataCheck, BaseTerraformCloudsplainingIAMScanner, ABC): |
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.
not sure, why you subclass ABC
here? there are no abstract annotations used.
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.
Actually we also need to implement cloudformation_analysis
which is only in the check itself
from checkov.terraform.checks.utils.base_cloudsplaining_iam_scanner import BaseTerraformCloudsplainingIAMScanner | ||
|
||
|
||
class BaseTerraformCloudsplaininResourceIAMCheck(BaseResourceCheck, BaseTerraformCloudsplainingIAMScanner, ABC): |
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.
same here
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.
same
|
||
from checkov.common.models.enums import CheckResult | ||
|
||
from cloudsplaining.scan.policy_document import PolicyDocument # noqa: TC002 |
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.
you can actually move it under TYPE_CHECKING
, but then you also have to import annotations
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.
cool, fixing now
… integrated between data and resource objects (bridgecrewio#4338) * Created abstraction for cloudsplaining to be used between resource and data in terraform * Added base resource check class for cloudsplaining * Removed usage of resource and data specific scanners * returned setup to normal * flake8 * fixed import * remove abc usage * fixed double class error in tests * Renamed classes and cache to use terraform to avoid similarities with cache in cloudformation * Renamed file * Returned abc usa\ge * ignore linting error as without it performence tests fail * Returned the cache name to be without terraform * Fixed parsing of policy in baseresouce check * fixed flake with import future annotations * Used correct class to initialize cache and fix the test
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
Added a base class for handling
clousplaining
checks, to allow future support of bothresource
anddata
checks without code duplication.Fixes # (issue)
New/Edited policies (Delete if not relevant)
Description
Include a description of what makes it a violation and any relevant external links.
Fix
How does someone fix the issue in code and/or in runtime?
Checklist: