Skip to content

Hotfix: AddIOCtoIOCCollectionAction Check indicators earlier (1314)#2067

Open
vg-svitla wants to merge 1 commit intodevelopfrom
hotfix/check_indicators_earlier
Open

Hotfix: AddIOCtoIOCCollectionAction Check indicators earlier (1314)#2067
vg-svitla wants to merge 1 commit intodevelopfrom
hotfix/check_indicators_earlier

Conversation

@vg-svitla
Copy link
Collaborator

@vg-svitla vg-svitla commented Mar 2, 2026

Relates to 1314

Summary by Sourcery

Guard the AddIOCtoIOCCollection action with an early validation of the indicators payload and release a hotfix version.

Bug Fixes:

  • Validate that the indicators argument is a list before executing the main AddIOCtoIOCCollection logic to prevent runtime errors.

Build:

  • Bump the Sekoia.io integration version from 2.69.0 to 2.69.1.

Documentation:

  • Document the 2.69.1 hotfix release and its indicator validation fix in the changelog.

@vg-svitla vg-svitla requested a review from squioc March 2, 2026 08:35
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 2, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Hotfix consolidates and moves the validation of the indicators argument to run before any indicator-type-specific logic in AddIOCtoIOCCollection, ensuring it is always a list, and bumps the connector version and changelog accordingly.

Updated class diagram for AddIOCtoIOCCollectionAction run method

classDiagram
    class AddIOCtoIOCCollectionAction {
        +run(arguments: dict) void
        +add_IP_action(indicators: list, ioc_collection_id: str, valid_for: int) void
        +add_generic_indicator_action(indicators: list, ioc_collection_id: str, valid_for: int, indicator_type: str) void
    }

    class IndicatorTypeMapping {
        +get(indicator_type: str) function
    }

    AddIOCtoIOCCollectionAction --> IndicatorTypeMapping : uses

    class RunArguments {
        +indicators: any
        +indicator_type: any
        +valid_for: any
        +ioc_collection_id: any
    }

    AddIOCtoIOCCollectionAction ..> RunArguments : reads
Loading

Flow diagram for updated AddIOCtoIOCCollectionAction.run validation and routing

flowchart TD
    A[Start run] --> B[Read indicators, indicator_type, valid_for from arguments]
    B --> C{Is indicators a list?}
    C -- No --> D[Raise ValueError: Indicators should be list type]
    D --> E[End run]
    C -- Yes --> F{indicator_type == IP address?}
    F -- Yes --> G[Call add_IP_action with indicators, ioc_collection_id, valid_for]
    G --> E
    F -- No --> H[Lookup indicator_type in indicator_type_mapping]
    H --> I{Mapping found?}
    I -- No --> J[Raise ValueError or handle unsupported indicator_type]
    J --> E
    I -- Yes --> K[Call mapped action with indicators, ioc_collection_id, valid_for]
    K --> E
Loading

File-Level Changes

Change Details Files
Centralize and run indicators type validation before indicator-type-specific processing in AddIOCtoIOCCollectionAction.
  • Validate that indicators is a list for all indicator types, not only IP addresses.
  • Raise a ValueError early when indicators is not a list, before any branching on indicator_type.
  • Keep IP-address specific handling in add_IP_action while making its execution depend on the shared pre-validation.
Sekoia.io/sekoiaio/intelligence_center/add_ioc_to_ioc_collection.py
Document and version the hotfix release.
  • Add 2.69.1 entry to the changelog describing the new indicators pre-check behavior.
  • Bump manifest version from 2.69.0 to 2.69.1 to match the changelog entry.
Sekoia.io/CHANGELOG.md
Sekoia.io/manifest.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@mchupeau-sk mchupeau-sk left a comment

Choose a reason for hiding this comment

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

Ok for me just to rebase with develop

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