Skip to content

Conversation

@kamalq97
Copy link
Contributor

@kamalq97 kamalq97 commented Jan 1, 2026

Related Issues

fixes: CIAC-14914

Description

Add support for Mimecast API 2.0 and implement async event fetching logic.

Version release notes:

  • Breaking Changes: Migrated from the legacy API 1.0 authentication method to OAuth2 client credentials flow for Mimecast API 2.0.

    • Added support for new API 2.0 authentication via the Client ID and Client Secret parameters.
    • Dropped support for API 1.0 authentication and removed the Application ID, Application Key, Access Key, and Secret Key parameters.
  • Breaking Changes: Removed the First fetch timestamp parameter. New integration instances will begin fetching events from the last minute.

  • Added support for the Fetch event types parameter that denotes the types of audit and SIEM events to fetch.

  • Added support for the siem_event_types, start_date, and end_date arguments in the !mimecast-get-events command.

  • Updated the Docker image to: demisto/py3-tools:1.0.0.6308650.

@kamalq97 kamalq97 self-assigned this Jan 1, 2026
@kamalq97 kamalq97 requested a review from JasBeilin January 1, 2026 08:56
@kamalq97 kamalq97 added enhancement inprogress It means the PR is still on progress, and should not be merged even if the build is green or approve python Pull requests that update Python code labels Jan 1, 2026
@kamalq97 kamalq97 marked this pull request as draft January 1, 2026 08:57
@github-actions
Copy link

github-actions bot commented Jan 1, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
Packs/Mimecast/Integrations/MimecastEventCollector
   MimecastEventCollector.py3964089%104–105, 135–136, 145, 224–225, 228–230, 232–235, 238–242, 246–247, 251, 255, 258, 330, 410–411, 510, 586, 603, 607, 706–707, 816–817, 854–856, 954–955
TOTAL3964089% 

Tests Skipped Failures Errors Time
31 0 💤 0 ❌ 0 🔥 8.649s ⏱️

@kamalq97 kamalq97 added ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. labels Jan 5, 2026
@kamalq97 kamalq97 marked this pull request as ready for review January 5, 2026 10:03
@content-bot content-bot removed the ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. label Jan 5, 2026
@content-bot
Copy link
Collaborator

Validate summary
The following errors were thrown as a part of this pr: BC112, IN164.
The following errors cannot be ignored: BC112, IN164.
If the AG100 validation in the pre-commit GitHub Action fails, the pull request cannot be force-merged.
The following errors don't run as part of the nightly flow and therefore can be force merged: BC112, IN164.

Verdict: PR can be force merged from validate perspective? ✅

@content-bot
Copy link
Collaborator

🤖 Content-bot Review Disclaimer

This review was generated by an AI-powered tool and may contain inaccuracies. Please be advised, and we extend our sincere apologies for any inconvenience this may cause.

Copy link
Collaborator

@content-bot content-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 there! Thanks for the update to the Mimecast pack. I've reviewed the changes and have a few points to discuss, primarily regarding the proxy implementation and test mocking.

Please ensure proxy arguments are passed correctly to the request methods rather than the aiohttp session, and update the unit tests to use AsyncMock for asynchronous methods. It would also be helpful to clarify the API 2.0 credential steps in the documentation and consolidate the breaking changes in the release notes.

Great work so far

@richardbluestone, @JasBeilin please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.

@@ -0,0 +1,4 @@
{
"breakingChanges": true,
"breakingChangesNotes": "Migrated from the legacy API 1.0 authentication method to OAuth2 client credentials flow for Mimecast API 2.0. Integration instances must be re-configured using OAuth2 Client ID and Client Secret."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding the removal of the 'First fetch timestamp' parameter to the breaking changes notes.

import aiohttp
from http import HTTPStatus
import asyncio
from typing import Any
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing imports cast and traceback.

self._proxy_url = handle_proxy().get("http", "") if proxy else None

async def __aenter__(self):
self._session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=self._verify), proxy=self._proxy_url)
Copy link
Collaborator

Choose a reason for hiding this comment

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

aiohttp.ClientSession does not accept a proxy argument.

raise DemistoException(f"There was an error with siem events call {fail_reason}")
while retry_count <= max_retries:
try:
async with self._session.request(method=method, url=url, headers=headers, **request_kwargs) as response:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Proxy configuration is missing in the request.

demisto.debug(f"[{event_type}] Received HTTP 401 Unauthorized. Generating new token and retrying...")
headers["Authorization"] = await self.get_authorization_header(force_generate_new_token=True)
# Retry immediately with new token
async with self._session.request(method=method, url=url, headers=headers, **request_kwargs) as response:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Proxy configuration is missing in the retry request.

| Base URL | Use `https://api.services.mimecast.com` for the Global region or review the [Mimecast guide on per-region Base URLs](https://integrations.mimecast.com/documentation/api-overview/global-base-urls/) to find the suitable Base URL. | True |
| Client ID | Refer to the help section for instructions on how to obtain API 2.0 OAuth2 credentials. | True |
| Client secret | Refer to the help section for instructions on how to obtain API 2.0 OAuth2 credentials. | True |
| Fetch events | | False |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a description for the "Fetch events" parameter.

| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| should_push_events | Set this argument to True in order to create events, otherwise the command will only display them. Possible values are: True, False. Default is False. | Required |
| should_push_events | If True, the command will push the events to the Cortex XSIAM dataset; otherwise, it will only display them. Default is False. | Required |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clarify if this argument is Required or Optional.

Note: The supported time format is yyyy-MM-ddThh:mm:ss+|-nnnn (2021-12-08T10:00:00-0400). The relevant fields are "datetime" or "eventTime"
# Mimecast

Mimecast is a cloud-based email security and management platform that provides comprehensive protection against email-borne threats, data leaks, and ensures business continuity through email archiving and continuity services.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Grammar suggestion: Insert 'and' between 'email-borne threats' and 'data leaks' for better sentence structure.


##### Mimecast Event Collector

- **Breaking Changes**: Migrated from the legacy API 1.0 authentication method to OAuth2 client credentials flow for Mimecast API 2.0.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consolidate all breaking changes under a single "Breaking Changes" bullet point for better readability and adherence to standards.


- Added support for the ***Fetch event types*** parameter that denotes the types of audit and SIEM events to fetch.

- Added support for the `siem_event_types`, `start_date`, and `end_date` arguments in the ***!mimecast-get-events*** command.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The argument name siem_event_types does not match the integration YAML. It should be event_types.

@richardbluestone
Copy link
Contributor

Hi there! Thanks for the update to the Mimecast pack. I've reviewed the changes and have a few points to discuss, primarily regarding the proxy implementation and test mocking.

Please ensure proxy arguments are passed correctly to the request methods rather than the aiohttp session, and update the unit tests to use AsyncMock for asynchronous methods. It would also be helpful to clarify the API 2.0 credential steps in the documentation and consolidate the breaking changes in the release notes.

Great work so far

@richardbluestone, @JasBeilin please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.

@julieschwartz18 Can you do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement inprogress It means the PR is still on progress, and should not be merged even if the build is green or approve python Pull requests that update Python code ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants