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

add new validator - DanglingCondition #253

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

nasbench
Copy link
Member

@nasbench nasbench commented Aug 9, 2024

Description

This PR adds a new validator - DanglingCondition

Motivation

In certain edge cases, a sigma rule author might reference an unknown detection definition from the condition in the form of 1 of something. Example:

title: Test
status: test
logsource:
    category: test
detection:
    selection:
        field1: val1
    filter_main_1:
        field1: val1
    filter_main_optional_1:
        field2: val2
    condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*

Currently pySigma gracefully handles the conversion without error but this might lead to confusion in certain tools and the semantically the rule contain an "error".

Solution

This PR adds a new validator that is very similar to the DanglingDetection. The difference being the use of the fact that when a ConditionSelector calls resolve_referenced_detections it will return an empty set if the detection definition doesn't exist (i.e match any patterns).

Copy link
Member

@frack113 frack113 left a comment

Choose a reason for hiding this comment

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

LGTM

@thomaspatzke thomaspatzke merged commit 7e65b81 into SigmaHQ:main Aug 9, 2024
12 checks passed
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