Skip to content

feat(threatmatch): migrate connector to manager-supported mode (#6868) - #6996

Open
jabesq wants to merge 6 commits into
masterfrom
feat/6868-threatmatch-manager-supported
Open

feat(threatmatch): migrate connector to manager-supported mode (#6868)#6996
jabesq wants to merge 6 commits into
masterfrom
feat/6868-threatmatch-manager-supported

Conversation

@jabesq

@jabesq jabesq commented Jul 10, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Normalize config files for manager-supported migration: fix the misspelled THREATMATCH_THREAT_ACTOR_AS_INSTRUSION_SET env var to THREATMATCH_THREAT_ACTOR_AS_INTRUSION_SET in docker-compose.yml, and add the connectors-sdk dependency in src/requirements.txt.
  • Add field descriptions to all Pydantic settings (OpenCTI, connector, and ThreatMatch sections) and tighten types: log_level is now a Literal, and import_from_date becomes optional with a field_validator defaulting to a 30-day relative window on first run.
  • Modernize datetime handling in config.py by switching to explicit datetime/timedelta/timezone imports.
  • Set manager_supported: true in the connector manifest.
  • Generate the connector config schema (__metadata__/connector_config_schema.json) and documentation (__metadata__/CONNECTOR_CONFIG_DOC.md) for manager-supported mode.

Related issues

Checklist

  • I consider the submitted work as finished
  • I have signed my commits using GPG key.
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

This connector was already partly modernized; this stack enhances the Pydantic settings (field descriptions, stricter types) and generates the config schema/doc required for manager-supported mode.

Copilot AI review requested due to automatic review settings July 10, 2026 13:59
@jabesq jabesq added the filigran team Item from the Filigran team. label Jul 10, 2026
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

🔴 Connector Linter errors detected

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the ThreatMatch external-import connector toward manager-supported mode by tightening and documenting its Pydantic settings, normalizing configuration inputs, and adding the generated schema/docs needed for catalog/manager usage.

Changes:

  • Updated config.py settings models with field descriptions, stricter types (e.g., Literal for log level), and a first-run defaulting strategy for import_from_date.
  • Fixed a misspelled ThreatMatch env var in docker-compose.yml and marked the connector as manager_supported: true.
  • Added generated manager configuration artifacts (connector_config_schema.json, CONNECTOR_CONFIG_DOC.md) and introduced a connectors-sdk dependency in requirements.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
external-import/threatmatch/src/threatmatch/config.py Modernizes datetime handling and enhances/validates settings models for manager-supported configuration.
external-import/threatmatch/src/requirements.txt Adds an additional dependency intended for manager-supported migration.
external-import/threatmatch/docker-compose.yml Corrects the ThreatMatch env var spelling for intrusion-set mapping.
external-import/threatmatch/metadata/connector_manifest.json Flags the connector as manager-supported.
external-import/threatmatch/metadata/connector_config_schema.json Adds generated JSON schema for manager configuration.
external-import/threatmatch/metadata/CONNECTOR_CONFIG_DOC.md Adds generated documentation for all configuration keys.

Comment thread external-import/threatmatch/src/threatmatch/config.py Outdated
Comment thread external-import/threatmatch/__metadata__/CONNECTOR_CONFIG_DOC.md Outdated
Comment thread external-import/threatmatch/src/requirements.txt Outdated
Comment thread external-import/threatmatch/docker-compose.yml
@jabesq
jabesq force-pushed the feat/6868-threatmatch-manager-supported branch from 924792d to 67ee030 Compare July 21, 2026 12:16
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6996       +/-   ##
===========================================
+ Coverage   35.64%   74.03%   +38.39%     
===========================================
  Files        2048        8     -2040     
  Lines      125310      651   -124659     
===========================================
- Hits        44672      482    -44190     
+ Misses      80638      169    -80469     
Files with missing lines Coverage Δ
external-import/threatmatch/src/main.py 72.22% <100.00%> (ø)
...ernal-import/threatmatch/src/threatmatch/config.py 100.00% <100.00%> (+6.66%) ⬆️

... and 2038 files with indirect coverage changes

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jabesq
jabesq force-pushed the feat/6868-threatmatch-manager-supported branch 3 times, most recently from 7eb74e8 to 5c47639 Compare July 23, 2026 09:21
jabesq added 6 commits July 23, 2026 17:02
…tion

- Fix docker-compose env var typo THREATMATCH_THREAT_ACTOR_AS_INSTRUSION_SET
  -> THREATMATCH_THREAT_ACTOR_AS_INTRUSION_SET so it maps to the settings field
- Add connectors-sdk dependency (required for config schema generation)
…nager-supported mode

Populate Field(description=...) on the opencti, connector and threatmatch
settings sections so the generated connector config schema and documentation
expose meaningful descriptions in the OpenCTI connector manager UI. Types,
defaults and validation behaviour are unchanged.
… for manager-supported mode

Add __metadata__/connector_config_schema.json and __metadata__/CONNECTOR_CONFIG_DOC.md,
generated from the ConnectorSettings Pydantic model. These provide the environment
variable contract consumed by the OpenCTI connector manager.
@jabesq
jabesq force-pushed the feat/6868-threatmatch-manager-supported branch from 5c47639 to fc0dd5d Compare July 23, 2026 15:03
@helene-nguyen
helene-nguyen self-requested a review July 24, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ThreatMatch): migrate connector to the catalog

3 participants