-
Notifications
You must be signed in to change notification settings - Fork 557
fix: Cleaning up the hashable content for the rule #4621
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
Conversation
detection_rules/rule.py
Outdated
@@ -1123,10 +1123,19 @@ def _post_dict_conversion(self, obj: dict) -> dict: | |||
def to_api_format(self, include_version: bool = True) -> dict: | |||
"""Convert the rule to the API format.""" | |||
|
|||
|
|||
def get_hashable_content(self, include_version: bool = False, include_integrations: bool = True) -> dict: |
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.
When we ship this, all integrations will invariably get a version bump because the sha256 would change with dropping the related_integrations and the first time all of the integrations rules will see a bump.
We can use |
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.
- Calculating both hashes to preserve backwards compatibility makes sense so im not sure where it's still bumping hashes in your testing. just remember, It may be legitimate rule changes.
- We should also think about how expensive the extra call (and to go one step further, even if we want to make adding related integrations optional at all) or just remove the field from calculation all together
- We'll want to make sure we refactor the other areas of
sha256()
in the test cases
736fe71
to
fd66fa0
Compare
Testing Updates During Release part
|
7196e72
to
ca7215a
Compare
Enhancement - GuidelinesThese guidelines serve as a reminder set of considerations when addressing adding a feature to the code. Documentation and Context
Code Standards and Practices
Testing
Additional Checks
|
fe3a039
to
e8b8215
Compare
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.
this lgtm based on all the local release branch testing. @traut when we merge, can we time a maintenance window and test version locks? If anything unexpected arises, we can safely revert this PR then. Note: @eric-forte-elastic is also bringing in a version lock PR that will test inadvertent double bumps so we could merge this one after his.
e8b8215
to
aa1f5ab
Compare
Pull Request
Issue link(s):
Summary - What I changed
related_integrations
field will be dropped from the dict that will be hashed to calculate the SHA256 hash of the rule.How To Test
Checklist
bug
,enhancement
,schema
,maintenance
,Rule: New
,Rule: Deprecation
,Rule: Tuning
,Hunt: New
, orHunt: Tuning
so guidelines can be generatedmeta:rapid-merge
label if planning to merge within 24 hoursContributor checklist