-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: cleaning of fields after dismissUntil expiration #5188
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
base: main
Are you sure you want to change the base?
Conversation
…, and also fix the restore/dismiss bug from the ui
@lucaspgz is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
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.
Bug: Batch Enrichment Function Requires List Input
The batch_enrich
function (and enrich_entity
which calls it) was updated to expect enrichments_list
as a list of dictionaries, with one dictionary per fingerprint. However, several call sites incorrectly pass a single dictionary instead of a list. This requires wrapping the dictionary in a list (e.g., [enrichments]
) or replicating it for multiple fingerprints (e.g., [enrichments] * len(fingerprints)
).
keep/api/bl/enrichments_bl.py#L954-L963
keep/keep/api/bl/enrichments_bl.py
Lines 954 to 963 in d19adc2
# Save the updated enrichment data in the database and Elasticsearch | |
batch_enrich( | |
tenant_id, | |
[fingerprint], | |
updated_enrichments, | |
action_type=ActionType.DISPOSE_ENRICHED_ALERT, | |
action_callee='system', | |
action_description='Restore previous status after dismiss', | |
session=session, | |
) |
keep/api/routes/alerts.py#L911-L912
keep/keep/api/routes/alerts.py
Lines 911 to 912 in d19adc2
fingerprints=fingerprints, | |
enrichments_list=enrichments, |
keep/api/routes/alerts.py#L935-L936
keep/keep/api/routes/alerts.py
Lines 935 to 936 in d19adc2
fingerprints=formatted_alert_ids, | |
enrichments_list=enrichments, |
Bug: Method Parameter Mismatch Causes Error
The enrich_entity
method is called with the parameter enrichments_list
, but its signature still expects enrichments
. This parameter name mismatch will cause a TypeError
.
keep/api/routes/alerts.py#L438-L439
keep/keep/api/routes/alerts.py
Lines 438 to 439 in d19adc2
fingerprint=fingerprint, | |
enrichments_list=enrichments, |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Closes #5047
📑 Description
This pull request addresses two main points:
Fixes the bug related to cleaning the dismissed, dismissUntil, and disposable_* fields of an alert after dismissUntil expiration, and also restores the alert's previous status (sent in batch_enrich now) when dismissUntil expires.
Fixes the bug in the UI where selecting two alerts in the feed, even if both are dismissed, triggers the dismiss pop-up, instead of the restore one in that case.
✅ Checks
My pull request adheres to the code style of this project
My code requires changes to the documentation
I have updated the documentation as required
All the tests have passed
ℹ Additional Information
It has been tested both with dedicated tests and via direct alert sending through API, dismissing them with a workflow, and also via the UI tool. It works correctly for single or multiple alerts, as needed.