Skip to content

migrate cyber_x#602

Open
haggit-eliyahu wants to merge 5 commits intomainfrom
migrate-cyber_x-integration
Open

migrate cyber_x#602
haggit-eliyahu wants to merge 5 commits intomainfrom
migrate-cyber_x-integration

Conversation

@haggit-eliyahu
Copy link
Contributor

No description provided.

@haggit-eliyahu haggit-eliyahu requested a review from a team as a code owner March 10, 2026 11:08
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

1 similar comment
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 introduces a complete integration for CyberX, a widely-deployed ICS, SCADA & IIoT security platform. The integration provides a suite of actions to enhance security operations by allowing users to fetch critical data such as alerts, events, and detailed endpoint information, as well as manage device connections and vulnerability reports. This addition significantly expands the platform's capabilities for industrial control system and IoT security.

Highlights

  • New Integration: A new integration for CyberX has been added, providing capabilities to interact with the CyberX platform for security operations.
  • Python 3.11 Compatibility: The integration is built with Python 3.11, aligning with modern Python standards and ensuring compatibility with the latest SOAR SDK.
  • Comprehensive Actions: Multiple actions are included, enabling endpoint enrichment, retrieval of alerts, connections, device vulnerability reports, and events from CyberX.
  • Core API Management: A dedicated CyberXManager class has been implemented to handle all API interactions, ensuring robust and centralized communication with the CyberX platform.

🧠 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.

Changelog
  • content/response_integrations/google/cyber_x/.python-version
    • Added Python version specification for 3.11.
  • content/response_integrations/google/cyber_x/init.py
    • Added package initialization file with copyright.
  • content/response_integrations/google/cyber_x/actions/EnrichEndpoints.py
    • Added Python script for enriching endpoint data based on IP address or hostname.
  • content/response_integrations/google/cyber_x/actions/EnrichEndpoints.yaml
    • Added YAML definition for the 'Enrich Endpoints' action.
  • content/response_integrations/google/cyber_x/actions/GetAlerts.py
    • Added Python script for fetching alerts from CyberX.
  • content/response_integrations/google/cyber_x/actions/GetAlerts.yaml
    • Added YAML definition for the 'Get Alerts' action.
  • content/response_integrations/google/cyber_x/actions/GetConnectionsforEndpoint.py
    • Added Python script for retrieving connections associated with an endpoint.
  • content/response_integrations/google/cyber_x/actions/GetConnectionsforEndpoint.yaml
    • Added YAML definition for the 'Get Connections for Endpoint' action.
  • content/response_integrations/google/cyber_x/actions/GetDeviceVulnerabilityReport.py
    • Added Python script for fetching device vulnerability reports.
  • content/response_integrations/google/cyber_x/actions/GetDeviceVulnerabilityReport.yaml
    • Added YAML definition for the 'Get Device Vulnerability Report' action.
  • content/response_integrations/google/cyber_x/actions/GetEvents.py
    • Added Python script for retrieving events from CyberX.
  • content/response_integrations/google/cyber_x/actions/GetEvents.yaml
    • Added YAML definition for the 'Get Events' action.
  • content/response_integrations/google/cyber_x/actions/Ping.py
    • Added Python script for testing connectivity to CyberX.
  • content/response_integrations/google/cyber_x/actions/Ping.yaml
    • Added YAML definition for the 'Ping' action.
  • content/response_integrations/google/cyber_x/actions/init.py
    • Added package initialization file with copyright.
  • content/response_integrations/google/cyber_x/core/CyberXManager.py
    • Added the core Python manager class for CyberX API interactions.
  • content/response_integrations/google/cyber_x/core/init.py
    • Added package initialization file with copyright.
  • content/response_integrations/google/cyber_x/definition.yaml
    • Added the main YAML definition file for the CyberX integration.
  • content/response_integrations/google/cyber_x/pyproject.toml
    • Added project configuration file, specifying dependencies and Python version.
  • content/response_integrations/google/cyber_x/release_notes.yaml
    • Added release notes, including Python 3.11 update and public source code availability.
  • content/response_integrations/google/cyber_x/resources/logo.svg
    • Added the SVG logo file for the CyberX integration.
  • content/response_integrations/google/cyber_x/tests/init.py
    • Added package initialization file with copyright.
  • content/response_integrations/google/cyber_x/tests/common.py
    • Added common utilities for integration testing.
  • content/response_integrations/google/cyber_x/tests/config.json
    • Added a configuration file for integration tests.
  • content/response_integrations/google/cyber_x/tests/conftest.py
    • Added pytest configuration for integration tests.
  • content/response_integrations/google/cyber_x/tests/test_defaults/init.py
    • Added package initialization file with copyright.
  • content/response_integrations/google/cyber_x/tests/test_defaults/test_imports.py
    • Added a default test to verify module imports.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-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.

Code Review

This pull request migrates the CyberX integration. A security audit identified critical issues including insecure default configurations (SSL verification disabled by default) and potential leakage of sensitive information in logs due to including raw API response content in exception messages. Additionally, the PR requires improvements in performance, specifically refactoring repeated API calls within loops. There are also several style guide adherence issues, such as missing type hints and incorrect docstring formats, and a lack of meaningful unit tests. A potential bug in device lookup by IP address also needs attention.

Comment on lines +53 to +76
for entity in target_entities:
try:
if entity.entity_type == EntityTypes.ADDRESS:
endpoint_information = cyberx_manager.get_device_by_ip_address(
entity.identifier
)
elif entity.entity_type == EntityTypes.HOSTNAME:
endpoint_information = cyberx_manager.get_device_by_host_name(
entity.identifier
)

if endpoint_information:
siemplify.result.add_entity_table(
entity.identifier,
flat_dict_to_csv(dict_to_flat(endpoint_information)),
)
entity.additional_properties.update(
add_prefix_to_dict(
dict_to_flat(endpoint_information), CYBERX_PREFIX
)
)
result_value = True
success_entities.append(entity)
except Exception as err:
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This loop is highly inefficient. It calls get_device_by_ip_address or get_device_by_host_name for each entity, and each of those methods makes a full API call to fetch all devices. This results in N+1 API calls, where N is the number of target entities. This can lead to poor performance and potential API rate limiting.

To optimize this, you should fetch all devices once before the loop, create lookup maps for IPs and hostnames, and then use these maps for O(1) lookups within the loop.

Here's an example of how to refactor this:

    try:
        all_devices = cyberx_manager.get_all_devices()
        ip_to_device = {d.get('ipAddress'): d for d in all_devices if d.get('ipAddress')}
        name_to_device = {d.get('name', '').lower(): d for d in all_devices if d.get('name')}
    except Exception as err:
        error_message = f'Error fetching device list: {err}'
        siemplify.LOGGER.error(error_message)
        siemplify.LOGGER.exception(err)
        siemplify.end(error_message, False)
        return

    for entity in target_entities:
        try:
            endpoint_information = None
            if entity.entity_type == EntityTypes.ADDRESS:
                endpoint_information = ip_to_device.get(entity.identifier)
            elif entity.entity_type == EntityTypes.HOSTNAME:
                endpoint_information = name_to_device.get(entity.identifier.lower())

            if endpoint_information:
                # ... (rest of the logic)

Comment on lines +51 to +69
for entity in target_entities:
try:
if entity.entity_type == EntityTypes.ADDRESS:
device_id = cyberx_manager.get_device_id_by_address(entity.identifier)

elif entity.entity_type == EntityTypes.HOSTNAME:
device_id = cyberx_manager.get_device_id_by_host_name(entity.identifier)

# If Device ID will not found an exception will be thrown from the manager.
device_connections = cyberx_manager.get_device_connections(device_id)

if device_connections:
siemplify.result.add_entity_table(
entity.identifier,
flat_dict_to_csv(dict_to_flat(device_connections)),
)
result_value = True
success_entities.append(entity)

Copy link
Contributor

Choose a reason for hiding this comment

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

high

This loop is highly inefficient. It calls get_device_id_by_address or get_device_id_by_host_name for each entity. Each of these calls triggers a full API request to get all devices, leading to N+1 API calls where N is the number of entities. This will cause performance issues.

To optimize, fetch all devices once before the loop, create lookup maps, and then find the device ID from the in-memory data.

Example refactoring:

    try:
        all_devices = cyberx_manager.get_all_devices()
        ip_to_device = {d.get('ipAddress'): d for d in all_devices if d.get('ipAddress')}
        name_to_device = {d.get('name', '').lower(): d for d in all_devices if d.get('name')}
    except Exception as err:
        # ... error handling for fetching devices ...
        return

    for entity in target_entities:
        try:
            device = None
            if entity.entity_type == EntityTypes.ADDRESS:
                device = ip_to_device.get(entity.identifier)
            elif entity.entity_type == EntityTypes.HOSTNAME:
                device = name_to_device.get(entity.identifier.lower())

            if not device or not device.get('id'):
                # Handle case where device or ID is not found
                continue

            device_id = device['id']
            device_connections = cyberx_manager.get_device_connections(device_id)
            # ... (rest of the logic)

"""
devices = self.get_all_devices()
for device in devices:
if ip_address in device.get("ipAddress"):
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using in with a string performs a substring search. To find a device by a specific IP address, an exact match is required. This is likely a bug that could lead to incorrect device matching if an IP address is a substring of another.

Suggested change
if ip_address in device.get("ipAddress"):
if device.get("ipAddress") == ip_address:

try:
response.raise_for_status()
except Exception as err:
raise CyberXManagerError(f"Error:{err}, Content:{response.content}")
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The validate_response method has several issues. It does not adhere to the repository's style guide, missing type hints and using an outdated docstring format. More critically, the exception handling includes the raw response content (response.text) in the error message, which can lead to sensitive information leakage in logs if the CyberX API returns sensitive data. It is recommended to avoid including the full response body in exception messages and to catch specific exceptions like requests.exceptions.HTTPError instead of a generic Exception to improve debugging and prevent hiding bugs.

Suggested change
raise CyberXManagerError(f"Error:{err}, Content:{response.content}")
raise CyberXManagerError(f"Error: {err}") from err



class CyberXManager:
def __init__(self, api_root, access_token, verify_ssl=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The CyberXManager class defaults to disabling SSL certificate verification (verify_ssl=False). Disabling SSL verification allows an attacker to perform Man-in-the-Middle (MITM) attacks and intercept or modify sensitive data transmitted between the SOAR platform and the CyberX API. It is highly recommended to enable SSL verification by default.

config = siemplify.get_configuration(PROVIDER)
api_root = config["API Root"]
access_token = config["Access Token"]
verify_ssl = config.get("Verify SSL", "false").lower() == "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The action script defaults to disabling SSL verification if the 'Verify SSL' configuration parameter is missing or set to 'false'. This is insecure as it exposes the connection to MITM attacks. The default should be to enable SSL verification.


ACTION_NAME = "CyberX_Get Alerts"
PROVIDER = "CyberX"
TABLE_TITLE = "Result ALerts"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is a typo in the table title. It should be "Result Alerts".

Suggested change
TABLE_TITLE = "Result ALerts"
TABLE_TITLE = "Result Alerts"

else:
output_message = "No alerts were found."

siemplify.end(output_message, json.dumps(alerts))
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This action produces a JSON result, but is missing the corresponding example file. According to the style guide (line 155), a resources/GetAlerts_json_example.json file must be created to document the output schema.

References
  1. If an action returns a JSON result, a corresponding JSON example file must exist in the integration's resources/ directory. (link)

Comment on lines +54 to +71
for entity in target_entities:
try:
if entity.entity_type == EntityTypes.ADDRESS:
device_report = cyberx_manager.get_vulnerability_report_by_address(
vulnerability_reports, entity.identifier
)

elif entity.entity_type == EntityTypes.HOSTNAME:
device_report = cyberx_manager.get_vulnerability_report_by_host(
vulnerability_reports, entity.identifier
)

if device_report:
siemplify.result.add_entity_table(
entity.identifier, flat_dict_to_csv(dict_to_flat(device_report))
)
result_value = True
success_entities.append(entity)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation iterates through all vulnerability reports for each target entity, which is inefficient (O(N*M) complexity). This can be optimized by creating lookup maps from the reports before iterating through the entities.

By building maps for IP addresses and hostnames to their reports, you can achieve near O(1) lookups inside the loop, improving performance significantly.

Example:

    vulnerability_reports = cyberx_manager.get_devices_vulnerability_reports()

    # Create lookup maps
    ip_to_report = {}
    for report in vulnerability_reports:
        for ip in report.get('ipAddresses', []):
            ip_to_report[ip] = report
    
    host_to_report = {r.get('name', '').lower(): r for r in vulnerability_reports if r.get('name')}

    for entity in target_entities:
        try:
            device_report = None
            if entity.entity_type == EntityTypes.ADDRESS:
                device_report = ip_to_report.get(entity.identifier)
            elif entity.entity_type == EntityTypes.HOSTNAME:
                device_report = host_to_report.get(entity.identifier.lower())

            if device_report:
                # ... rest of the logic

else:
output_message = "No events were found."

siemplify.end(output_message, json.dumps(events))
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This action produces a JSON result, but is missing the corresponding example file. According to the style guide (line 155), a resources/GetEvents_json_example.json file must be created to document the output schema.

References
  1. If an action returns a JSON result, a corresponding JSON example file must exist in the integration's resources/ directory. (link)

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

4 similar comments
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@haggit-eliyahu haggit-eliyahu force-pushed the migrate-cyber_x-integration branch from b8b0c76 to cc37009 Compare March 18, 2026 13:33
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

1 similar comment
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

1 similar comment
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@haggit-eliyahu haggit-eliyahu force-pushed the migrate-cyber_x-integration branch from 5cc4872 to b53e619 Compare March 22, 2026 09:52
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

2 similar comments
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@haggit-eliyahu haggit-eliyahu force-pushed the migrate-cyber_x-integration branch from 4d2b23d to 4fe7fd2 Compare March 22, 2026 15:03
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

1 similar comment
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

1 similar comment
@github-actions
Copy link

Marketplace Validation Failed

Click to view the full report

Validation Report

🧩 Integrations
Pre-Build Stage

cyber_x

Validation Name Details
⚠️ Integration Version Bump New integration project.toml and release_note.yaml version must be initialize to 1.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants