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

Malop management v2 api addition #38613

Conversation

shabina-metron
Copy link
Contributor

Contributing to Cortex XSOAR Content

Make sure to register your contribution by filling the contribution registration form

The Pull Request will be reviewed only after the contribution registration form is filled.

Status

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

Related Issues

fixes: link to the issue

Description

A few sentences describing the overall goals of the pull request's commits.

Must have

  • Tests
  • Documentation

@ilaredo
Copy link
Contributor

ilaredo commented Feb 16, 2025

Hi @shabina-metron,
Please try to do git squash to @sudhanshu-metron commits, it should fix it. regarding your sign, lets see after the squash if it will refreshed.

fetchfile-progress

malop-processes command date filter changes

Test file changes

Integration script changes

integration test file changes

removing demisto.log from the integration script

mapping changes

pre-commit resolution

precommit resolution

test file update

cybereason_test file fix

malop to incident test case update

adding test cases to complete the checks

adding test case coverage

adding more test coverage

fixing error in test file

adding test cases

Test Case for pre commit hooks

More Test Cases for pre commit test criteria

error fix in for the test cases

test case improvement

Increasing test case to complete the pre-commit check

autopep8 error resolution

readme file

metadata file

Add save_jsession function

Added jsession header

fix bug

Added logs

add mmng/v2 api

add detection/details

add detection/details

added pagination logic

fix-error

update logs

update time

saved query data in context data

mmng/v2 api update

add required field in command

bump app version

fix line too long error

update unit test coverage
@suraj-metron suraj-metron force-pushed the malop-management-v2-api-addition branch from 9cbf037 to aa1d1f5 Compare February 18, 2025 13:52
@shabina-metron
Copy link
Contributor Author

Hi ilaredo

We are working on squashing commits, meanwhile could you please review the PR as we have customers eagerly waiting for this version.

Thanks!

Copy link
Contributor

@ilaredo ilaredo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!
few minor changes

@@ -1477,13 +1499,78 @@ def malop_to_incident(malop: str) -> dict:
if not isinstance(malop, dict):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the signature of the function malop declared str

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from str to dict.

malopCreationTime = malop.get('simpleValues', {}).get('creationTime', {}).get('values', ['2010-01-01'])[0]
malopUpdateTime = malop.get('simpleValues', {}).get('malopLastUpdateTime', {}).get('values', ['2010-01-01'])[0]
else:
malopCreationTime = str(malop.get('creationTime', '2010-01-01'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what type creationTime and lastUpdateTime? it could parse to str?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is an epoch and it can be parsed to str.


if malop.get('elementValues'):
if malop.get('elementValues', {}).get('rootCauseElements', {}).get('elementValues', ''):
rootCauseElementName = (malop.get('elementValues', {}).get('rootCauseElements', {}).get('elementValues',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according the api, elementValues. rootCauseElements. elementValues is array?
also, it contain dictionaries?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are correct. The dictionary key was incorrect, I have updated it.

)

edr_guid_list, non_edr_guid_list = [], []
total_malops_available = malop_management_response["data"]["totalHits"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use safe access by using .get() instead of []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


edr_guid_list, non_edr_guid_list = [], []
total_malops_available = malop_management_response["data"]["totalHits"]
malop_management_response = malop_management_response["data"]["data"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,12 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 2 release note is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted the unnecessary one.

'getIncidents',
{'query': f'name:"Cybereason Malop {malop_guid}"'}
)
malop_incident = response['data']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use .get() instead of []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

entries.append({'Type': EntryType.NOTE, 'ContentsFormat': 'json', 'Contents': json.dumps(inc)})
entries_str = json.dumps(entries)
execute_command('addEntries', {'id': malop_incident['id'], 'entries': entries_str})
malop_incident_id = malop_incident['id']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use .get() instead of []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

entries_str = json.dumps(entries)
execute_command('addEntries', {'id': malop_incident['id'], 'entries': entries_str})
malop_incident_id = malop_incident['id']
malop_incident_status = inc['status']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use .get() instead of []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -2,7 +2,7 @@
"name": "Cybereason",
"description": "Endpoint detection and response to manage and query malops, connections and processes.",
"support": "partner",
"currentVersion": "2.1.17",
"currentVersion": "2.1.21",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it should be 2.1.18?

Copy link
Contributor Author

@shabina-metron shabina-metron Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have checked the latest version from the XSOAR marketplace:https://cortex.marketplace.pan.dev/marketplace/details/Cybereason

@ilaredo
Copy link
Contributor

ilaredo commented Feb 24, 2025

Hi @shabina-metron ,
we haven't heard from you in a while.
Is the action of squash commits working for you? It is mandatory that all the committers sign the CLA.

@shabina-metron
Copy link
Contributor Author

Hi ilaredo,
Thank you for your comments, I will start with them right away.
As for the squash commits, we did it and squashed it into one commit. We have signed the CLA, but the check is still failing on PR. Could you please check the same?
Thanks

@ilaredo
Copy link
Contributor

ilaredo commented Feb 25, 2025

No worries, I will take a look at it!

@shabina-metron
Copy link
Contributor Author

Hi ilaredo,
I have fixed all the comments.
Can you please have a look at it?

Thanks!!

@ilaredo ilaredo added the ready-for-instance-test In contribution PRs, this label will cause a trigger of a build with a modified pack from the PR. label Mar 2, 2025
@ilaredo
Copy link
Contributor

ilaredo commented Mar 2, 2025

Hi @shabina-metron,
it appears that your git squash did not work properly. Could you please redo it for @sudhanshu-metron's commits? We are unable to proceed until all commiters have signed the CLA document.

@content-bot
Copy link
Collaborator

For the Reviewer: Trigger build request has been accepted for this contribution PR.

@content-bot
Copy link
Collaborator

For the Reviewer: Successfully created a pipeline in GitLab with url: https://gitlab.xdr.pan.local/xdr/cortex-content/content/-/pipelines/2604517

@content-bot content-bot removed the ready-for-instance-test In contribution PRs, this label will cause a trigger of a build with a modified pack from the PR. label Mar 2, 2025
@ilaredo
Copy link
Contributor

ilaredo commented Mar 4, 2025

Hi @shabina-metron, it has been a while since we last communicated. I suggest that you open a new pull request with the changes. Please copy the code to a new branch where @sudhanshu-metron and @shabina-metron commits are not signed on them. This will help us avoid any issues with the CLA, and it will be the quickest way to proceed with the review.
Im closing this PR. please feel free to reach me here or via Slack.

@ilaredo ilaredo closed this Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution Form Filled Whether contribution form filled or not. Contribution Thank you! Contributions are always welcome! External PR Partner Support Level Indicates that the contribution is for Partner supported pack Partner Partner-Approved pending-contributor The PR is pending the response of its creator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants