brexhq / substation

Substation is a toolkit for routing, normalizing, and enriching security event and audit logs.
https://substation.readme.io
MIT License
322 stars 16 forks source link

feat(condition): Add Number Less Than Inspector #186

Closed Mallika05 closed 3 months ago

Mallika05 commented 3 months ago

Description

Adds number_less_than inspector

Motivation and Context

Ref: https://github.com/brexhq/substation/pull/183

This is for comparing a number's value, which is currently only possible using the string_match function like this:

sub.cnd.str.match({ object: {source_key: 'FIELD'}, pattern: '^[0-9]{,3}$'}),

This inspector is simpler to understand:

sub.cnd.num.less_than({ object: {source_key: 'FIELD'}, value: 999 }), // < 999

The target value type is float64, but this works just as well with integers.

How Has This Been Tested?

Added unit tests

Types of changes

Checklist: