Skip to content

feat(tenable-security-center): migrate connector to the catalog (#7560) - #7597

Open
Hugo Dupras (jabesq) wants to merge 8 commits into
masterfrom
feat/7560-tenable-security-center-catalog
Open

Hugo Dupras (jabesq) wants to merge 8 commits into
masterfrom
feat/7560-tenable-security-center-catalog

Conversation

@jabesq

Copy link
Copy Markdown
Member

Proposed changes

  • Migrate the connector to the catalog as a manager-supported integration: configuration now flows through a validated Pydantic ConnectorSettings model and is handed to OpenCTIConnectorHelper via to_helper_config().
  • Add tenable_security_center/settings.py mirroring the previous configuration variables 1:1, with SecretStr for the API keys, Literal enums for the severity and TLP options, and DatetimeFromIsoString for TSC_EXPORT_SINCE.
  • Wire the settings into the existing app.py in place — the file layout, class names, schedule_iso scheduling and logging are deliberately unchanged.
  • Remove the now-unreachable legacy configuration system (ports/config.py, adapters/config/env.py, adapters/config/config_yaml.py and the orphaned ConfigLoaderError), which dropped ~1000 lines and the connector's last uses of the deprecated pycti.get_config_variable helper.
  • Normalize the configuration files: config.yaml.sampleconfig.yml.sample (required by the SDK settings loader) and env.sample.env.sample (repo convention); required variables are uncommented with ChangeMe, defaulted ones are commented out.
  • Generate __metadata__/connector_config_schema.json and CONNECTOR_CONFIG_DOC.md, and set manager_supported: true in the manifest.
  • Add 15 unit tests covering the new settings and their wiring.

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 is the manager-supported pass only; the connector is intentionally not "verified" yet. Restructuring into a connector/ package, the connector.py/main.py split, and STIX-ID determinism work are out of scope and left for a separate pass.

Two points worth reviewing:

  • pycti was bumped 7.260904.07.260907.0 to match the pin in connectors-sdk, without which the dependency set is unresolvable.
  • Four variables that were previously mandatory (severity_min_level, process_systems_without_vulnerabilities, marking_definition, duration_period) now carry their documented values as defaults. This is a small, deliberate relaxation that improves catalog UX — happy to revert if you would rather keep them strictly required.

A mypy override was added for connectors_sdk.* because the SDK is fully typed but ships no py.typed marker, which mypy --strict rejects. Adding that marker upstream would be the real fix.

Validation: 68 tests pass, black/isort/flake8 clean, ruff and mypy --strict clean (enforced by this connector's own conftest.py), and generate_config_schema is reproducible with no diff.

@jabesq Hugo Dupras (jabesq) added the filigran team Item from the Filigran team. label Sep 8, 2026
@jabesq
Hugo Dupras (jabesq) marked this pull request as ready for review September 8, 2026 13:36
Copilot AI lite review requested due to automatic review settings September 8, 2026 13:36
@github-actions

github-actions Bot commented Sep 8, 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 tenable-security-center external-import connector to the OpenCTI connector catalog as a manager-supported integration by replacing the legacy config loader stack with validated connectors-sdk / Pydantic settings, and by generating the associated catalog metadata (schema + config docs).

Changes:

  • Introduces ConnectorSettings (connectors-sdk BaseConnectorSettings) and wires it into app.py, keeping the existing runtime structure intact.
  • Removes the legacy env/YAML config loader system and its related error type, reducing dead/unreachable configuration paths.
  • Adds config normalization (config.yml.sample, .env.sample), generates __metadata__/connector_config_schema.json + CONNECTOR_CONFIG_DOC.md, and adds unit tests for settings + wiring.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
external-import/tenable-security-center/tenable_security_center/settings.py Adds connectors-sdk/Pydantic settings model and TSC-specific config section.
external-import/tenable-security-center/app.py Switches runtime wiring from legacy loader to ConnectorSettings + to_helper_config().
external-import/tenable-security-center/tests/tests_connector/test_settings.py Adds unit tests validating settings parsing/defaults and invalid-input handling.
external-import/tenable-security-center/tests/test_main.py Adds wiring tests for ConnectorSettings → helper config and connector instantiation.
external-import/tenable-security-center/metadata/connector_manifest.json Marks the connector as manager_supported: true.
external-import/tenable-security-center/metadata/connector_config_schema.json Adds generated catalog JSON schema for configuration.
external-import/tenable-security-center/metadata/CONNECTOR_CONFIG_DOC.md Adds generated configuration documentation table.
external-import/tenable-security-center/config.yml.sample Adds SDK-compatible YAML sample filename/format.
external-import/tenable-security-center/.env.sample Adds repo-convention env sample with required variables surfaced.
external-import/tenable-security-center/docker-compose.yml Updates compose environment block to reflect required vs optional variables.
external-import/tenable-security-center/README.md Replaces inline config variable listing with a pointer to generated config docs.
external-import/tenable-security-center/pyproject.toml Adds connectors-sdk dependency and mypy overrides for connectors_sdk.*.
external-import/tenable-security-center/src/init.py Re-exports ConnectorSettings for the config schema generator import path.
external-import/tenable-security-center/tenable_security_center/ports/errors.py Removes now-orphaned legacy ConfigLoaderError.
external-import/tenable-security-center/.gitignore Ignores local build/** artifacts.
external-import/tenable-security-center/tenable_security_center/ports/config.py Removes legacy config port interfaces (unreachable after migration).
external-import/tenable-security-center/tenable_security_center/adapters/config/env.py Removes legacy env-based config loader implementation.
external-import/tenable-security-center/tenable_security_center/adapters/config/config_yaml.py Removes legacy YAML config loader implementation.
external-import/tenable-security-center/env.sample Deletes legacy env sample (superseded by .env.sample).
external-import/tenable-security-center/config.yaml.sample Deletes legacy YAML sample (renamed to config.yml.sample).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +18 to +35
import stix2 # type: ignore[import-untyped] # stix2 does not provide stubs
from connectors_sdk import (
BaseConfigModel,
BaseConnectorSettings,
BaseExternalImportConnectorConfig,
DatetimeFromIsoString,
ListFromString,
)
from pydantic import Field, SecretStr

_TLP_MARKINGS = {
# "TLP:CLEAR" and "TLP:WHITE" map to the same marking definition
"TLP:CLEAR": stix2.TLP_WHITE,
"TLP:WHITE": stix2.TLP_WHITE,
"TLP:GREEN": stix2.TLP_GREEN,
"TLP:AMBER": stix2.TLP_AMBER,
"TLP:RED": stix2.TLP_RED,
}
Comment on lines +131 to +133
assert settings.tsc.marking_definition == "TLP:CLEAR"
assert settings.tsc.tlp_marking.definition_type == "tlp"

…anager-supported mode (#7560)

Bump pycti to 7.260907.0 to match the version pinned by connectors-sdk,
which is required to resolve the connector dependencies.
…ode (#7560)

Cover the new Pydantic settings (validation, defaults, unique connector id
default) and their wiring into the existing connector entry point.
Let mypy follow the untyped connectors-sdk imports so the strict type check
of the settings module keeps passing.
…ers (#7560)

The Pydantic settings introduced by the catalog migration replaced the
hand-rolled configuration system, leaving ports/config.py and
adapters/config/env.py unreachable from any entry point. adapters/config/
config_yaml.py was already dead before the migration, and ConfigLoaderError
was only ever raised by those loaders.

Removing them drops ~1000 lines and the last uses of the deprecated
pycti.get_config_variable helper in this connector.
The editable install used for local validation writes a build/ directory
inside the connector, which must not be tracked.
@jabesq
Hugo Dupras (jabesq) force-pushed the feat/7560-tenable-security-center-catalog branch from 8b6adb2 to 32940ce Compare September 10, 2026 14:24
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. needs-product-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tenable-security-center): migrate connector to the catalog

4 participants