[CISA KEV] Default create_infrastructures to false#6283
Open
MrStarkEG wants to merge 1 commit intoOpenCTI-Platform:masterfrom
Open
[CISA KEV] Default create_infrastructures to false#6283MrStarkEG wants to merge 1 commit intoOpenCTI-Platform:masterfrom
MrStarkEG wants to merge 1 commit intoOpenCTI-Platform:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #6283 +/- ##
===========================================
- Coverage 40.50% 0.09% -40.42%
===========================================
Files 2141 1661 -480
Lines 128230 100015 -28215
===========================================
- Hits 51943 94 -51849
- Misses 76287 99921 +23634
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The CISA KEV connector creates Vulnerability and Software entities for each catalog entry. When cisa.create_infrastructures was true (the old default) it ALSO emitted an Infrastructure SDO with the same name as the Software SCO. KEV catalog entries (PHP, Joomla, Laravel, GNU C Library, Apache Struts, October CMS, etc.) are software products. None of them map to any value in the STIX 2.1 infrastructure-type-ov vocabulary (amplification, botnet, command-and-control, firewall, routers-switches, ...), so the connector silently emitted Infrastructure objects with an empty infrastructure_types field — non-compliant STIX that's also duplicated by the Software SCO already in the bundle. Flipping the default to false stops fresh deployments from generating that noise while preserving the legacy opt-in path for existing users who rely on the behaviour. No code logic changed — just the default. Also adds the first test suite for this connector (previously zero): 32 tests covering config defaults, env-var overrides, bundle composition in every flag combination, regression cases for the real product names that prompted this change, and end-to-end stix2.Bundle serialisation. Docs (README, __metadata__/CONNECTOR_CONFIG_DOC.md, connector_config_schema.json) updated in lock-step with the default.
85b4c46 to
202e298
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6284
Summary
The CISA Known Exploited Vulnerabilities connector has a
cisa.create_infrastructuresflag that, when enabled (the old default), emitted a STIX Infrastructure SDO alongside the Software SCO for every KEV entry. This PR flips the default tofalseand keeps the legacy behaviour as opt-in.Why the default was wrong
CISA KEV entries are software products (PHP, Joomla, Laravel, GNU C Library, Apache Struts, October CMS, Spring Framework, Skype for Business, …). STIX 2.1
infrastructure-type-ovenumerates:amplification,anonymization,botnet,command-and-control,control-system,exfiltration,firewall,hosting-malware,hosting-target-lists,phishing,reconnaissance,routers-switches,staging,unknown,workstation. None of these values describe a software product likePHP.With the old default, the connector therefore emitted Infrastructure SDOs with an empty
infrastructure_typesfield — STIX-non-compliant, and duplicated by the Software SCO that the same bundle already contains.Field evidence
Observed in a production OpenCTI deployment that had been running this connector with the default enabled:
infrastructure_typesempty/unsetSoftwareSCOs — the Infrastructure SDOs are pure duplicates with wrong STIX semanticsWhat this PR changes
src/models/configs/cisakev_configs.py— default flippedTrue→False; description rewritten to explain the STIX-compliance reasoningREADME.md— default column + sample docker-compose snippet updated; expanded description in the parameters table__metadata__/CONNECTOR_CONFIG_DOC.md— default column updated__metadata__/connector_config_schema.json— default + description updatedNo code logic changed. Behaviour when the flag is explicitly set to
trueis identical to before.Testing
Adds the first test suite for this connector (previously zero): 32 tests.
tests/test_config.py(8 tests) — config defaults, env-var override via the realConfigLoader, other defaults unchangedtests/test_bundle.py(24 tests) — bundle composition in every flag combination,kev_flag_onlyinteraction, real product-name regression cases (PHP, Joomla, Laravel, Apache Struts, October CMS, GNU C Library, Skype for Business), and end-to-endstix2.Bundle.serialize()round-tripTruemakes the relevant tests fail, proving the suite actually pins the behaviour.E2E verification against a real OpenCTI
Deployed the fixed connector against a local OpenCTI stack (platform + worker + redis + elasticsearch + minio + rabbitmq), fed it the real CISA KEV catalog (1,577 CVEs):
create_infrastructures=false)create_infrastructures=true)statuscompletecompleteerrors[][]Compliance with connector standards (
docs/05-code-quality-standards.md)black --checkclean (12 files)isort --profile black --checkcleanno_generated_id_stix,unused-import,no-value-for-parameter)Backward compatibility
Users who depend on the legacy behaviour keep working unchanged — they just need to set
CISA_CREATE_INFRASTRUCTURES=trueexplicitly in their config. Thekev_flag_onlymode is untouched.Discussion
If maintainers would rather remove the Infrastructure path entirely (since it emits STIX-non-compliant objects even when opted in), I'm happy to follow up with a second PR doing exactly that. Flipping the default is the minimally-invasive change and seemed safer as a first step.