-
Notifications
You must be signed in to change notification settings - Fork 512
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
Update threshold rule schema to disallow empty field string #1098
Update threshold rule schema to disallow empty field string #1098
Conversation
detection_rules/schemas/base.py
Outdated
@@ -15,6 +15,7 @@ | |||
|
|||
DATE_PATTERN = r'\d{4}/\d{2}/\d{2}' | |||
MATURITY_LEVELS = ['development', 'experimental', 'beta', 'production', 'deprecated'] | |||
NON_EMPTY_STR = r'.+' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NON_EMPTY_STR = r'.+' |
detection_rules/schemas/v7_12.py
Outdated
@@ -31,7 +32,7 @@ class ThresholdCardinality(jsl.Document): | |||
field = jsl.StringField(required=True) | |||
value = jsl.IntField(minimum=1, required=True) | |||
|
|||
field = jsl.ArrayField(jsl.StringField(required=True, default="")) | |||
field = jsl.ArrayField(jsl.StringField(required=False, pattern=NON_EMPTY_STR), required=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field = jsl.ArrayField(jsl.StringField(required=False, pattern=NON_EMPTY_STR), required=True) | |
field = jsl.ArrayField(jsl.StringField(required=False, min_length=1), required=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if you switch to min_length
Done 👍 . I also locked versions as this should be the last change to 7.12.1 |
"sha256": "9aeb1b1c1c4b9fb39b564774f25afea20210e5789afbde43998e680892678b7c", | ||
"version": 3 | ||
"sha256": "9aee800e271c99dfee70b36fbe34a3607ad2b2c9030f77b26db66977cce7621f", | ||
"version": 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 the joys of versioning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to pull this lock into main
btw
Issues
related to #1097
related to #1099 (same change targeting main)
Summary
Changes
threshold.field
to disallow empty strings and instead just use an empty array for non-defined values.