You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
INFO:caracara.client:Setting up the Caracara client and configuring authentication
INFO:caracara.client:Client ID: XXXXX; Cloud: auto; Member CID: None
INFO:caracara.client:Base URL: US1
INFO:caracara.client:Requesting API token
INFO:caracara.client:Resolved Base URL: https://api.us-2.crowdstrike.com
INFO:caracara.client:Caracara client configured
INFO:caracara.modules.CustomIoaApiModule:Describing all Falcon IOA Rule Groups matching filter: None
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Pagination Style 1: Grabbing all pages from the partial handle_errors function (limit: 100)
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Grabbing first batch of items 1 to up to 100
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Retrieved a batch of 3 items
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Total number of resources: 3
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Pagination Style 1: Grabbing all pages from the handle_errors function (limit: 100)
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Grabbing first batch of items 1 to up to 100
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Retrieved a batch of 9 items
INFO:caracara.modules.CustomIoaApiModule.caracara.common.pagination:Total number of resources: 9
INFO:caracara.common.batching:Batch data retrieval for handle_errors (9 items)
INFO:caracara.common.batching:Divided the item IDs into 1 batches
INFO:caracara.common.batching:ThreadPoolExecutor-0_0 | Batch worker started with a list of 9 items. Function: handle_errors
INFO:caracara.common.batching:ThreadPoolExecutor-0_0 | Retrieved 9 resources
Traceback (most recent call last):
File "/home/zaci/PycharmProjects/Caracara-Bug/scripts/reproduce.py", line 15, in <module>
client.custom_ioas.update_rule_group(rule_group)
File "/home/zaci/PycharmProjects/Caracara-Bug/.venv/lib/python3.10/site-packages/caracara/modules/custom_ioa/custom_ioa.py", line 134, in update_rule_group
new_group = self._create_update_delete_rules(new_group, comment=comment)
File "/home/zaci/PycharmProjects/Caracara-Bug/.venv/lib/python3.10/site-packages/caracara/modules/custom_ioa/custom_ioa.py", line 183, in _create_update_delete_rules
response = instr(self.custom_ioa_api.update_rules)(body={
File "/home/zaci/PycharmProjects/Caracara-Bug/.venv/lib/python3.10/site-packages/caracara/modules/custom_ioa/custom_ioa.py", line 29, in handle_errors
raise ValueError(errors)
ValueError: [{'code': 409, 'message': 'rule group version mismatch, reload data and try again'}]
Expected behavior
The version id should not be incremented when there are no changes to the rule group.
Environment
Operating System Version
Linux arch 6.11.2-arch1-1 #\1 SMP PREEMPT_DYNAMIC Fri, 04 Oct 2024 21:51:11 +0000 x86_64 GNU/Linux
# Update the existing rules, if there are any
if len(existing_rules) > 0:
response = instr(self.custom_ioa_api.update_rules)(body={
"comment": comment,
"rule_updates": [rule.dump_update() for rule in existing_rules],
- "rulegroup_version": group.version + 1,+ "rulegroup_version": group.version,
"rulegroup_id": group.id_,
})
raw_group = response["body"]["resources"][0]
The text was updated successfully, but these errors were encountered:
Thank you so much for raising this! You're right that we do not handle the case where a rule is submitted but has not been changed in this library. Assigning myself because this is a case that we should handle.
Bug Report Template
Rule group version mismatch error when updating IOA rule group rules.
Describe the bug
I receive a 409 'rule group version mismatch, reload data and try again' when attempting to update existing rules for an IOA rule group.
It appears to be due to the client locally incrementing the version when submitting
custom_ioa_api.update_rules()
.To Reproduce
Expected behavior
The version id should not be incremented when there are no changes to the rule group.
Environment
Operating System Version
Linux arch 6.11.2-arch1-1 #\1 SMP PREEMPT_DYNAMIC Fri, 04 Oct 2024 21:51:11 +0000 x86_64 GNU/Linux
Python Version
Python 3.10.14
Poetry Version
1.8.3
Python Package Versions
Additional context
I am able to stop the error by removing the increment in custom_ioa.py.
caracara/caracara/modules/custom_ioa/custom_ioa.py
Line 186 in 507b378
The text was updated successfully, but these errors were encountered: