-
Notifications
You must be signed in to change notification settings - Fork 0
Add more options to search params #15
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
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.
Pull Request Overview
This PR enhances the suite of search_* methods by adding description-based filtering, pagination controls, and tag support, plus a new filter_aliases field for DFIQ searches. It also reorders the search_graph signature to inject a default graph and updates corresponding tests.
- Added
description,count, andpageparameters (with defaults) to indicator, entity, observable, and DFIQ searches - Introduced
filter_aliasesin the DFIQ search query - Changed
search_graphsignature to makegraphoptional with a default, and updated tests
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| yeti/api.py | Extended search methods with description, pagination, tags, and DFIQ filter_aliases; updated search_graph API |
| tests/e2e.py | Adjusted end-to-end indicator search test to exercise description and tags filters |
| tests/api.py | Updated unit tests to assert new count, page, description, tags, and filter_aliases in the JSON payload |
Comments suppressed due to low confidence (2)
yeti/api.py:195
- Docstring for
search_indicatorsis missing the newly addedcountandpageparameters. Please add entries under Args to describe their purpose and defaults.
tags: The tags of the indicator to search for.
tests/api.py:32
- The new pagination (
page) behavior isn't covered by existing tests. Consider adding a test that passes a non-zeropagevalue to verify pagination works as intended.
result = self.api.search_indicators(
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
udgover
left a comment
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.
just a suggestion for future version. Otherwise LGTM!
| API_TOKEN_ENDPOINT = "/api/v2/auth/api-token" | ||
|
|
||
|
|
||
| SUPPORTED_IOC_TYPES = [ |
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.
Do you think we should add a dedicated api endpoint in yeti observables definitions to provide supported types? Otherwise, how would you handle custom observables?
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.
Yes, that's a great point. Opened yeti-platform/yeti#1254 to track this.
This pull request introduces enhancements to the Yeti API and its test suite, focusing on expanding search capabilities, improving functionality, and refining test coverage. Key updates include adding new parameters to search methods, introducing support for additional IOC types, and implementing a new test for linking objects.
Enhancements to search functionality:
yeti/api.py: Expanded search methods (search_indicators,search_entities,search_observables,search_dfiq, andsearch_graph) to accept additional parameters likedescription,tags,count, andpagefor more granular and paginated results. Updated error handling to ensure at least one search criterion is provided. [1] [2] [3] [4] [5]yeti/api.py: AddedSUPPORTED_IOC_TYPESto define a comprehensive list of supported IOC types for observables.Test suite improvements:
tests/api.py: Updated existing test cases (test_search_indicators,test_search_entities,test_search_observables,test_search_dfiq, andtest_search_graph) to validate the new parameters and ensure API calls are correctly structured. [1] [2] [3] [4] [5]tests/e2e.py: Added a new test casetest_link_objectsto verify linking objects functionality and graph traversal.API method refinements:
yeti/api.py: Updatedmatch_observablesto provide advanced matching capabilities, including fetching neighbors and handling unknown observables.yeti/api.py: Refinedsearch_graphto set default values forgraph,count, andpage, and clarified documentation for parameters. [1] [2]These changes improve the flexibility and usability of the Yeti API while ensuring robust testing to support the new features.