-
Notifications
You must be signed in to change notification settings - Fork 40
1P Updates: GitSync #390
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?
1P Updates: GitSync #390
Conversation
Summary of ChangesHello @gnishant-gupta, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the GitSync integration to align with a new first-party (1P) API client for Chronicle SOAR. The changes involve migrating existing API calls to a standardized 'TIPCommon' module, enhancing data model handling for various SOAR entities, and updating core dependencies. This modernization effort aims to improve the robustness, maintainability, and future compatibility of GitSync with the evolving SOAR platform. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
❌ Marketplace Validation Failed Click to view the full reportValidation Report🧩 IntegrationsPre-Build Stagegit_sync
|
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.
Code Review
This pull request migrates the GitSync integration to use first-party (1P) APIs from TIPCommon, which is a significant and positive refactoring for maintainability. The changes are extensive, touching many files to update API calls. My review has found several critical issues related to incorrect API usage and undefined attributes that will cause runtime errors. I've also noted some areas where error handling has been degraded and inconsistencies in the implementation. It's crucial to address the critical issues before merging.
| gitsync.api.add_dynamic_env_param( | ||
| id_validator(dynParam, "name", "id", current_parameters), | ||
| siemplify, | ||
| id=dynParam.get("id", 0), | ||
| name=dynParam.get("name", ""), | ||
| value=current_parameters.get("value", ""), | ||
| type=current_parameters.get("type", ""), | ||
| default_value=current_parameters.get("defaultValue", ""), | ||
| optional_json=current_parameters, | ||
| ) |
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.
The call to gitsync.api.add_dynamic_env_param is incorrect. The method add_dynamic_env_param in SiemplifyApiClient was not updated to use the new 1P API and still expects a single dictionary argument param. The current call passes siemplify as the first argument, followed by keyword arguments, which will result in a TypeError.
The method in SiemplifyApiClient is:
def add_dynamic_env_param(self, param):
res = self.session.post("settings/AddOrUpdateDynamicParameters", json=param)
self.validate_response(res)
return res.contentYou should either update add_dynamic_env_param to use the new 1P API or construct the param dictionary as it was done previously. The previous logic was: gitsync.api.add_dynamic_env_param(id_validator(dynParam, "name", "id", current_parameters)).
content/response_integrations/power_ups/git_sync/core/GitSyncManager.py
Outdated
Show resolved
Hide resolved
| install_integration( | ||
| chronicle_soar=self._siemplify, | ||
| integration_identifier=integration_name, | ||
| integration_name="", | ||
| version=store_integration["version"], | ||
| is_certified=store_integration["isCertified"], | ||
| ) |
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.
| current_cause= id_validator( | ||
| cause, | ||
| ("rootCause", "forCloseReason"), | ||
| "rootCause", | ||
| "id", | ||
| current_causes, | ||
| ), | ||
| ) |
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.
The uniqueness check for case close reasons in id_validator has been reduced from checking both rootCause and forCloseReason to just rootCause. This could lead to incorrect updates if rootCause is not unique on its own. It's safer to check for uniqueness on both fields as it was before.
The previous check was: id_validator(cause, ("rootCause", "forCloseReason"), "id", current_causes).
| import_simulated_case( | ||
| chronicle_soar=siemplify, | ||
| case_data=case | ||
| ) |
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 code directly calls import_simulated_case from TIPCommon.rest.soar_api. While this works, it's inconsistent with the pattern used elsewhere in this PR, where API calls are wrapped in gitsync.api (SiemplifyApiClient). For better maintainability and consistency, consider using the wrapper method gitsync.api.import_simulated_case(siemplify, case).
gitsync.api.import_simulated_case(siemplify, case)
content/response_integrations/power_ups/git_sync/release_notes.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: gnishant <[email protected]>
…arketplace into gitsync_1p_migration
|
❌ Marketplace Validation Failed Click to view the full reportValidation Report🧩 IntegrationsPre-Build Stagegit_sync
|
|
❌ Marketplace Validation Failed Click to view the full reportValidation Report🧩 IntegrationsPre-Build Stagegit_sync
|
Integration: GitSync - 1P Migration
Checklist:
Please ensure you have completed the following items before submitting your PR.
This helps us review your contribution faster and more efficiently.
General Checks:
Open-Source Specific Checks:
For Google Team Members and Reviewers Only:
Screenshots (If Applicable)
If your changes involve UI or visual elements, please include screenshots or GIFs here.
Ensure any sensitive data is redacted or generalized.
Further Comments / Questions
Any additional comments, questions, or areas where you'd like specific feedback.