-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SIEM][Detection Engine] Adds lists feature flag and list values to the REST interfaces #60171
[SIEM][Detection Engine] Adds lists feature flag and list values to the REST interfaces #60171
Conversation
…or easier usage by developers
…t" for the boolean_operators
This comment has been minimized.
This comment has been minimized.
… (that I tested locally on my computer)
Pinging @elastic/siem (Team:SIEM) |
x-pack/legacy/plugins/siem/server/lib/detection_engine/feature_flags.test.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/utils.test.ts
Show resolved
Hide resolved
@@ -82,4 +84,7 @@ export const addPrepackagedRulesSchema = Joi.object({ | |||
references: references.default([]), | |||
note: note.allow(''), | |||
version: version.required(), | |||
|
|||
// TODO: Remove the hasListsFeatures once this is ready for release | |||
lists: hasListsFeature() ? lists.default([]) : lists.forbidden().default([]), |
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.
Curious, what's the .default([])
do after forbidden? I assumed that by adding forbidden, only undefined
was allowed?
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.
It says that it is forbidden but the value will be an empty array for 7.7 on input. This keeps downstream logic and types simple to be just an empty array for 7.7 with the feature flag even off. That makes it where I don't have to use the feature flag very often and I don't have to worry about it accepting an undefined/null
since it is an array.
Arrays are typically empty arrays and defaulted when they are empty compared to a value that is a non-array which would be undefined/null
x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/schemas/response/rules_schema.ts
Outdated
Show resolved
Hide resolved
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! Had pretty minor comments. Pulled down and ran through all the tests you described in your summary 👍.
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.
All the changes look good. Ran locally and the steps worked well. LGTM.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
) Summary - #60022 - Follow up on #60171 - Modifies boolean filters to enum of "included" and "excluded" - Adds operator types of enum "match", "match_all", "list", and "exists" - Adds values properties to include those for "list" - DOES NOT FILTER ON THE VALUES JUST YET (That will be a follow on PR)
…stic#62320) Summary - elastic#60022 - Follow up on elastic#60171 - Modifies boolean filters to enum of "included" and "excluded" - Adds operator types of enum "match", "match_all", "list", and "exists" - Adds values properties to include those for "list" - DOES NOT FILTER ON THE VALUES JUST YET (That will be a follow on PR)
) (#62956) Summary - #60022 - Follow up on #60171 - Modifies boolean filters to enum of "included" and "excluded" - Adds operator types of enum "match", "match_all", "list", and "exists" - Adds values properties to include those for "list" - DOES NOT FILTER ON THE VALUES JUST YET (That will be a follow on PR)
Summary
Testing:
To turn on/off the feature flag do this with an env variable (set this in your .bashrc/.zshrc):
Expect to see this error in the console when the environment variable is set:
Expect create and update to work when the environment variable is set and look like this:
Expect these errors when the environment variable is not set:
Expect that this is backwards compatible with the feature flag but not necessarily forwards compatible. This means:
You can have older data that never had lists and it will show up as an empty list when you query it. (backwards compatible)
You might have lists and remove the env. variable and get back items as if the list was not there for (forwards compatible)
You can export without lists, flip on the env flag and import with newer lists feature (backwards compatible)
You can export lists and it will not work with an older system (not forwards compatible)
Checklist
Delete any items that are not applicable to this PR.