Skip to content

fix(tests): use valid list operators in Falco rule exception tests#711

Merged
tembleking merged 2 commits intomasterfrom
fix/falco-rule-test-list-operators
Feb 26, 2026
Merged

fix(tests): use valid list operators in Falco rule exception tests#711
tembleking merged 2 commits intomasterfrom
fix/falco-rule-test-list-operators

Conversation

@rosenbloomb-sysdig
Copy link
Copy Markdown
Contributor

Summary

Fixed TestRuleFalcoWithExceptions to comply with stricter validator enforcement of list field operators.

Problem

The test was failing with validation error:

filter error: '=' operator not supported list filters.
Location: rule: TERRAFORM TEST ... - Attach to cluster-admin Role

This was caused by recent deployment of stricter validators that enforce the use of compatible operators for list fields. List fields (like ka.req.binding.subjects) must use compatible operators (in, exists, intersects) rather than the = operator.

Solution

  1. Removed subjects_equal exception that used = operator with the list field ka.req.binding.subjects
  2. Added explicit comps = ["in"] to only_one_field_without_comps exception to prevent it from defaulting to the = operator

Test plan

  • Test passes locally with staging environment
  • Test validated with Falco agent 14.4.0

Fixes validation errors without any breaking changes to the actual provider functionality.

🤖 Generated with Claude Code

Fixed TestRuleFalcoWithExceptions to comply with stricter validator
enforcement of list field operators. List fields must use compatible
operators (in, exists, intersects) rather than the = operator.

Changes:
- Removed `subjects_equal` exception that used = operator with list field
- Added explicit `comps = ["in"]` to `only_one_field_without_comps`
  exception to prevent defaulting to = operator

This resolves validation errors from Falco agent 14.4.0:
"filter error: '=' operator not supported list filters"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 23, 2026 17:13
@rosenbloomb-sysdig rosenbloomb-sysdig requested a review from a team as a code owner February 23, 2026 17:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes test validation errors in TestRuleFalcoWithExceptions by updating exception definitions to comply with stricter Falco rule validation that enforces compatible operators for list fields. The changes address a validation error where the = operator was incorrectly used with list-type fields like ka.req.binding.subjects, which require operators like in, exists, or intersects.

Changes:

  • Removed the subjects_equal exception that used the incompatible = operator with the list field ka.req.binding.subjects
  • Added explicit comps = ["in"] to the only_one_field_without_comps exception to prevent defaulting to the = operator

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sysdig/resource_sysdig_secure_rule_falco_test.go Outdated
Comment thread sysdig/resource_sysdig_secure_rule_falco_test.go Outdated
Removed `only_one_field_without_comps` exception as it became identical
to `only_one_field` after adding the required `comps = ["in"]`. The
original intent was to test behavior when comps is omitted, but since
omitting comps defaults to the invalid `=` operator for list fields,
this test case no longer serves a distinct purpose.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@tembleking tembleking left a comment

Choose a reason for hiding this comment

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

This is currently detecting a breaking change in the API. I would like to leave it on hold until we determine that it's OK to break this for current customers that may be using it, or we rollback and support previous behavior in the API.

@rosenbloomb-sysdig rosenbloomb-sysdig added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@tembleking tembleking merged commit 6dda328 into master Feb 26, 2026
177 checks passed
@tembleking tembleking deleted the fix/falco-rule-test-list-operators branch February 26, 2026 09:36
fcracker79 pushed a commit that referenced this pull request Mar 5, 2026
)

Fixed `TestRuleFalcoWithExceptions` to comply with stricter validator
enforcement of list field operators.

The test was failing with validation error:
```
filter error: '=' operator not supported list filters.
Location: rule: TERRAFORM TEST ... - Attach to cluster-admin Role
```

This was caused by recent deployment of stricter validators that enforce
the use of compatible operators for list fields. List fields (like
`ka.req.binding.subjects`) must use compatible operators (`in`,
`exists`, `intersects`) rather than the `=` operator.
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.

4 participants