Skip to content

Allow Sieve numeric matches on JSONDict children#2719

Open
BharatDeva wants to merge 1 commit into
certtools:developfrom
BharatDeva:fix/sieve-jsondict-numeric-2599
Open

Allow Sieve numeric matches on JSONDict children#2719
BharatDeva wants to merge 1 commit into
certtools:developfrom
BharatDeva:fix/sieve-jsondict-numeric-2599

Conversation

@BharatDeva

Copy link
Copy Markdown

Fixes #2599

Summary

This updates Sieve numeric-match validation so fields below harmonization entries typed as JSONDict are not rejected during static validation.

For example, extra is typed as JSONDict, so a Sieve rule such as:

if extra.min_amplification > 5 {
    ...
}

should be allowed to parse and then be evaluated at runtime against the event value.

Known harmonized fields are still statically checked against the existing numeric-compatible types.

Testing

INTELMQ_ROOT_DIR=/mnt/c/Users/bhara/OneDrive/Desktop/Python/intelmq/intelmq \
INTELMQ_TEST_EXOTIC=1 \
PYTHONPATH=. \
python -m unittest intelmq.tests.bots.experts.sieve.test_expert

Result:

Ran 61 tests in 10.918s

OK

Additional checks:

git diff --check
python -m compileall -q intelmq/bots/experts/sieve/expert.py intelmq/tests/bots/experts/sieve/test_expert.py

Signed-off-by: BharatDeva <278575558+BharatDeva@users.noreply.github.com>
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.

Sieve does not support numeric comparation in extra.*

1 participant