Skip to content

fix(general): Support list definition in external custom policies#7437

Open
inbalavital wants to merge 1 commit intomainfrom
bugfix/support-list-definition
Open

fix(general): Support list definition in external custom policies#7437
inbalavital wants to merge 1 commit intomainfrom
bugfix/support-list-definition

Conversation

@inbalavital
Copy link
Copy Markdown
Contributor

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

Problem
Loading external custom policies with a list-type definition block crashes with AttributeError: 'list' object has no attribute 'get' in get_complex_operator() in checkov/common/checks_infra/checks_parser.py:359

The validator at validate_check_config() checkov/common/checks_infra/checks_parser.py:193
explicitly accepts both list and dict definitions, but parse_raw_check() common/checks_infra/checks_parser.py:202 passed the list directly to _parse_raw_check() common/checks_infra/checks_parser.py:234, which assumes a dict.

Fix
In parse_raw_check() common/checks_infra/checks_parser.py:205, wrap list-type definitions as an implicit AND: [cond1, cond2] → {"and": [cond1, cond2]}. This is consistent with how the Bridgecrew platform represents compound policies.

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

@inbalavital inbalavital changed the title fix(general): Support list definition in checks fix(general): Support list definition in external custom policies Feb 12, 2026
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.

1 participant