Skip to content
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

gcp_chronicle module deletes search in ResultsConnector instead of DeleteConnector #1636

Closed
pcoccoli opened this issue Jan 12, 2024 · 0 comments · Fixed by #1638
Closed

gcp_chronicle module deletes search in ResultsConnector instead of DeleteConnector #1636

pcoccoli opened this issue Jan 12, 2024 · 0 comments · Fixed by #1638

Comments

@pcoccoli
Copy link
Contributor

Describe the bug
Since the search (or "rule" in Chronicle) is deleted in create_results_connection Kestrel hits a double-deletion after all pages are retrieved. The second deletion causes an HTTPError exception (404) since the rule has already been deleted.

To Reproduce
Steps to reproduce the behavior:

  1. Run a Kestrel statement like x = GET network-traffic FROM stixshifter://my_chronicle WHERE dst_port = 80 ...

Expected behavior
No errors

Screenshots

15:58:19 DEBUG stix_shifter_utils.utils.file_helper returning options_mapping for: /home/jdoe/huntingspace/lib/python3.10/site-packages/stix_shifter_modules/gcp_chronicle/stix_translation/json/to_stix_map.json
15:58:19 ERROR stix_shifter_modules.gcp_chronicle.stix_transmission.error_mapper failed to map: {'message': "\n\n\n\nNot Found\n\nContent:\n{'code': 404,\n 'message': 'generic::not_found: rule with ID '\n            'ru_36fa328e-2fb5-4bec-979d-858bdfca80d1 could not be found',\n 'status': 'NOT_FOUND'}\n\nRequest URL:\nhttps://example-backstory.googleapis.com/v2/detect/rules/ru_36fa328e-2fb5-4bec-979d-858bdfca80d1/detections?page_size=1000"}
15:58:19 DEBUG stix_shifter_modules.gcp_chronicle.stix_transmission.results_connector Deleting the search id in results_connector
15:58:19 INFO stix_shifter_modules.gcp_chronicle.stix_transmission.results_connector User doesn't have permission to delete the search id
15:58:19 ERROR kestrel_jupyter_kernel.kernel Exception occurred
...
kestrel.exceptions.DataSourceError: [ERROR] DataSourceError: [worker: Transmitter-33:1] STIX-shifter transmission.result() failed: gcp_chronicle connector error =>
Not Found
Content:
{'code': 404,
 'message': 'generic::not_found: rule with ID '
            'ru_36fa328e-2fb5-4bec-979d-858bdfca80d1 could not be found',
 'status': 'NOT_FOUND'}

Note that the error message "User doesn't have permission to delete the search id" seems incorrect - it's logged for any error.

While reviewing the code, I noticed the ResultsConnector is deleting the search; shouldn't the DeleteConnector do that? That's how other modules (e.g. qradar) work.

Desktop (please complete the following information):

  • OS: N/A
  • Browser N/A
  • Version N/A

Additional context
Kestrel doesn't actually do the delete operation; that will be addressed in a separate kestrel-lang issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant