feat: ES intel integration + refactor input_type to boolean flags#5
feat: ES intel integration + refactor input_type to boolean flags#5CTIBurn0ut wants to merge 6 commits into
Conversation
…output checkboxes
…write/delete support
There was a problem hiding this comment.
Pull request overview
Implements additive output routing for the OpenCTI stream modular input, making KV Store writes always-on while optionally supporting Splunk index audit/replay output and Splunk Enterprise Security (ES) Threat Intel KV-store integration.
Changes:
- Replaces the prior
input_typesingle-select with two independent boolean flags:index_outputandes_intel_output. - Refactors
opencti_stream_helper.pyinto a single enrich-once pipeline that always writes/deletes to TA KV store, and conditionally writes to ES intel KV stores and/or to a Splunk index. - Adds ES intel bridging helpers (collection mapping, deterministic
_key, write/delete helpers) and includes several enrichment/logging/timestamp robustness fixes.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
TA-opencti-for-splunk-enterprise/package/bin/opencti_stream_helper.py |
Adds ES intel integration helpers and refactors the streaming handler into an additive pipeline with optional index + ES outputs. |
TA-opencti-for-splunk-enterprise/globalConfig.json |
Updates UCC input schema to replace input_type with index_output and es_intel_output checkboxes and updates the input table fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@romain-filigran Whenever you're ready |
🐛 Bug:
|
- Splunk ES does not have a "url_intel" collection; the correct name is "http_intel". Without this fix, any URL indicator upsert throws a "collection not found" error at runtime. - batch_save() expects records as positional args, not a bare dict. Restored the *[record] unpacking pattern. Ref: PR #5 review
The ES checkbox help text referenced "url_intel" which does not exist in Splunk ES. The correct collection name is "http_intel". Ref: PR #5 review
✅ Fixes pushed (2 commits)Commit 1 —
|
Summary
This PR implements two related changes that were designed and discussed together:
1. Replace
input_typesingleSelect with boolean checkboxes (globalConfig.json)Before: A mutually exclusive
singleSelect(kvstore|index) that forced a choice between two output modes.After: Two independent
checkboxfields:index_output— Enable Index Output (default: off) — write events to a Splunk index for audit/replayes_intel_output— Enable Splunk ES Threat Intel Integration (default: off) — push indicators into ES intel KV storesKV Store is now always the primary, always-on store. Index and ES intel are additive options.
2. Refactor
opencti_stream_helper.py— additive pipeline + ES intel bridgeArchitecture change
The old
if input_type == "kvstore" / elif input_type == "index"branching is replaced with a three-stage additive pipeline:ES Intel Bridge (new)
es_serviceconnection is opened scoped toSplunkEnterpriseSecuritySuite— this resolves the app namespace write permission issue that prevented the TA from writing to ES intel collections.write_to_es_intel()upserts intoip_intel,domain_intel,http_intel,file_intel, oremail_intelbased onmain_observable_type.delete_from_es_intel()removes indicators scoped by both value and source (opencti:<input_name>) — safe blast radius, never touches other feeds.sourcefield is set toopencti:<input_name>for full provenance in the ES Threat Intelligence Management UI.score(0–100) is mapped to ESweight(1–3).Bug fixes included
exist_in_kvstoreexceptreplaced — only 404 returns False, all other errors re-raiseparsed_stix.get("id")(wrong); now uses_keyconsistently everywhereenrich_generic_payloadextensionsdict was never deleted — now removed to prevent KV store bloat%Y-%m-%dT%H:%M:%S.%fZand%Y-%m-%dT%H:%M:%SZformatswarninginstead of a silentprintPost-review fixes
ES_INTEL_MAP"Url"mapping corrected fromurl_intel→http_intel(Splunk ES useshttp_intelfor URL indicators)batch_save()batch_save(*[record])instead ofbatch_save(record)globalConfig.jsonhttp_intelinstead ofurl_intelNew helpers
map_score_to_weight(score)— OpenCTI score → ES weightparse_event_timestamp(ts, logger)— robust multi-format timestamp parser_es_intel_key(value, source)— stable MD5_keyfor ES intel recordsES_INTEL_MAP— observable type → ES collection + field mappingwrite_to_es_intel()/delete_from_es_intel()— ES intel write/delete with lazy handle cachingFiles Changed
TA-opencti-for-splunk-enterprise/globalConfig.jsonTA-opencti-for-splunk-enterprise/package/bin/opencti_stream_helper.pyTesting Notes
es_intel_outputis automatically disabled for that run with an error log — the TA continues normally.input_type = kvstoreorinput_type = indexwill default both new flags to0(off) on upgrade — no breaking change for existing deployments.