-
Notifications
You must be signed in to change notification settings - Fork 154
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
Allow optional strict checking of variable names in EQL expressions #2678
Conversation
This pull request does not have a backport label. Could you fix it @faec? 🙏
NOTE: |
an encouraging CI failure :-)
|
🌐 Coverage report
|
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. Nice addition!
This fixes the issue in #2607 where spec file prevention conditions with nonexistent variable names are silently skipped, which led to conditions being unknowingly skipped because of copy-paste errors. It adds a flag
allowMissingVariables
to the EQL evaluation functions, and sets it tofalse
when evaluating spec file preventions. (I left ittrue
when evaluating upgrade conditions and AST conditions which I believe are used in autodiscovery, to avoid breaking code that depends on the current behavior, though those call sites might deserve a closer look at some point.)Once invalid variables in spec files became an error, some of the existing tests started failing because of the variable errors from #2606, so I folded that change into this one and added full tests.
Fixes #2607.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry in./changelog/fragments
using the changelog toolI have added an integration test or an E2E test