Skip to content
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

fix(general): Enable running cloned policies in case the OOTB policy is suppressed #4281

Merged
merged 10 commits into from
Jan 19, 2023

Conversation

tronxd
Copy link
Contributor

@tronxd tronxd commented Jan 18, 2023

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

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Handle cases where cloned policies are not ran in case their OOTB policy is suppressed

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:

  • My code follows the style guidelines of this project
  • 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
  • Any dependent changes have been merged and published in downstream modules

checkov/main.py Show resolved Hide resolved
bc_cloned_checks = custom_policies_integration.bc_cloned_checks
runner_filter.bc_cloned_checks = bc_cloned_checks
custom_policies_integration.policy_level_suppression = policy_level_suppression
runner_filter.set_suppressed_policies(policy_level_suppression)
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like you have this block of code 3 times here, can you extract to a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed IMO (we won't reuse it anywhere else than main)

checkov/runner_filter.py Show resolved Hide resolved
@tronxd tronxd requested a review from bo156 January 19, 2023 08:33
@tronxd tronxd requested a review from gruebel January 19, 2023 09:34
Copy link
Contributor

@gruebel gruebel left a comment

Choose a reason for hiding this comment

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

🏖️

@tronxd tronxd merged commit 58229c1 into main Jan 19, 2023
@tronxd tronxd deleted the cloned_suppressed_policies branch January 19, 2023 09:49
reemodo pushed a commit to reemodo/checkov that referenced this pull request Jan 22, 2023
…is suppressed (bridgecrewio#4281)

* enable running cloned policies in case the OOTB policy is suppressed

* flake8 lint

* mypy

* UT

* lint

* lint

* UT

* PR comment
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.

3 participants