Skip to content

Problem : Rule loader should reject unsupported logic edge cases #2920

@akshat4703

Description

@akshat4703

Problem

While experimenting with capa rule logic, I noticed that some rule constructs are currently accepted during rule loading even though they are not safe for the optimized matcher/indexer.

In particular, certain logical edge cases can lead to ambiguous or incorrect evaluation behavior.

Examples include:

  • top-level not statements
  • nested not constructs (e.g. not: not: ...)
  • top-level count(...): 0 statements

These patterns may conflict with assumptions made by the optimized rule matcher and rule indexer.

Example

For example, a rule containing something like:

not:

  api: CreateFileA
Or
not:
  not:
    api: CreateFileA
Similarly, constructs like:
count(api(CreateFileA)): 0
may introduce ambiguity or unexpected behavior during rule evaluation.

Expected Behavior

Rules containing unsupported logic constructs should be rejected during rule loading with a clear validation error.

This would:
	•	prevent subtle evaluation bugs
	•	ensure rules remain compatible with the optimized matcher/indexer
	•	provide clearer feedback to rule authors when invalid constructs are used.

Related Work #2913 

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions