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

feat(GTI): Private URL scanning #117

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pabloperezj
Copy link

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

Copy link

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

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

Hi @pablobpezj and reviewers,

I'm currently reviewing this pull request and will provide my feedback in a few minutes. In the meantime, I'm giving you a summary of the pull request's content to help you and other reviewers quickly understand the changes and intent.

This pull request, titled "feat(GTI): Private URL scanning", aims to add functionality for scanning private URLs using the Google Threat Intelligence (GTI) integration. The changes include:

  • Addition of private_url method: A new method private_url has been added to the GoogleThreatIntelligence.py file (lines 173-182) to handle requests for private URL analysis reports. This method uses the _http_request method with a specific endpoint for private URLs.
  • Modification of debug logging: The debug logging in private_file_scan (lines 362-367) has been updated to reflect that it's now handling private file scans (lines 375-378).
  • Addition of private_url_scan method: A new method private_url_scan has been added (lines 412-421) to initiate private URL scans via a POST request to the appropriate GTI endpoint.
  • New output function: A new function build_private_url_output (lines 1435-1463) has been added to format the output for private URL scans.
  • Improved debug messages: The debug messages in private_file_command (lines 1784-1787) have been updated for clarity (lines 1837-1840).
  • Added private_url_command function: A new function private_url_command (lines 1885-1915) has been added to handle the new private URL commands.
  • Added private_url_scan_and_get_analysis function: A new function private_url_scan_and_get_analysis (lines 2212-2256) has been added to handle scheduled private URL scans and analysis retrieval.
  • Added private_scan_url_command function: A new function private_scan_url_command (lines 2286-2290) has been added to handle private URL scans.
  • Updated scan_url function: The scan_url function (lines 2293-2310) has been updated to support both private and public URL scans.
  • Updated main function: The main function (lines 2794-2809) has been updated to include the new private URL commands (lines 2945-2966).

The changes appear to be well-structured and address the stated goal. However, I'll need to verify the functionality and test coverage during my full review.

Here's a little something to lighten the mood:

Code flows like a stream,
Tests catch bugs, a gentle hand,
Clean code, pure delight.

Looking forward to completing the review shortly!

Copy link

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

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

This pull request introduces private URL scanning functionality, which is a valuable addition. The implementation looks generally good, but there are a few minor points to address regarding consistency and documentation.

I've referenced elements from the Google Python Style Guide in this review, specifically around docstrings and naming conventions.

@@ -2794,6 +2945,10 @@ def main(params: dict, args: dict, command: str):
results = private_file_command(client, args)
elif command == f'{COMMAND_PREFIX}-privatescanning-file-scan':
results = private_file_scan(client, args)
Copy link

Choose a reason for hiding this comment

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

We should rename this to private_scan_file_command to keep consistency.

Copy link
Author

Choose a reason for hiding this comment

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

Yes but URL scan command is called scan_url_command while file scan command is called file_scan. We should rename this command too.

'url',
'title',
'last_http_response_content_sha256',
'positives',
Copy link

Choose a reason for hiding this comment

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

Let's call this detection_ratio

Copy link
Author

Choose a reason for hiding this comment

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

We are calling this attribute positives in all commands (it appears in all build_<ioc>_output methods).

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 this pull request may close these issues.

2 participants