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

feat(general): Update range includes to handle range values #6867

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tsmithv11
Copy link
Collaborator

@tsmithv11 tsmithv11 commented Nov 22, 2024

User description

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

Description

range_includes can handle ranges in the value like [4,10-20]

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

Generated description

Below is a concise technical summary of the changes proposed in this PR:

Enhance the RangeIncludesAttributeSolver class to support range values in the value parameter, allowing for more flexible attribute checks. This update processes range strings (e.g., "10-20") by converting them into a list of integers, thus enabling the solver to handle both single values and ranges effectively. Additionally, new test cases have been added to validate this functionality, ensuring that both range_includes and range_not_includes operations work correctly with the updated logic.

TopicDetails
Testing Enhancements Add test cases to validate the new range handling logic in RangeIncludesAttributeSolver, ensuring both range_includes and range_not_includes operations work correctly.
Modified files (6)
  • tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/test_solver.py
  • tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/test_solver.py
  • tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/JsonPathRangeIncludesListWRange.yaml
  • tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/RangeNotIncludesListWRange.yaml
  • tests/terraform/graph/checks_infra/attribute_solvers/range_includes_solver/RangeIncludesListWRange.yaml
  • tests/terraform/graph/checks_infra/attribute_solvers/range_not_includes_solver/JsonPathRangeNotIncludesListWRange.yaml
Latest Contributors(2)
UserCommitDate
tsmithv11feat-general-Update-ra...April 22, 2024
lirshindalmanfeat-general-Add-image...September 28, 2023
Range Handling Enhance the RangeIncludesAttributeSolver to support range values in the value parameter, allowing for more flexible attribute checks.
Modified files (1)
  • checkov/common/checks_infra/solvers/attribute_solvers/range_includes_attribute_solver.py
Latest Contributors(2)
UserCommitDate
tsmithv11feat-general-Update-ra...April 22, 2024
[email protected]...feat-general-igraph-li...January 25, 2023
This pull request is reviewed by Baz. Join @tsmithv11 and the rest of your team on (Baz).

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