feat(logrhythm-incidents): add external-import connector for LogRhythm cases (#6728)#6729
feat(logrhythm-incidents): add external-import connector for LogRhythm cases (#6728)#6729SamuelHassine wants to merge 4 commits into
Conversation
…m cases Add a new EXTERNAL_IMPORT connector that periodically pulls LogRhythm cases via the Case API and imports them into OpenCTI as STIX Incidents. This is the import side of a bidirectional LogRhythm integration. Refs #6728
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6729 +/- ##
===========================================
- Coverage 32.26% 0.41% -31.85%
===========================================
Files 1986 1901 -85
Lines 122165 119854 -2311
===========================================
- Hits 39413 494 -38919
- Misses 82752 119360 +36608
📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
LogRhythm cases are case-management artifacts, so they must map to OpenCTI Case-Incidents (CustomObjectCaseIncident) rather than Incidents, which are reserved for alarms/detections. Add severity-based priority. Refs #6728
…se-Incidents (#6728) LogRhythm exposes two distinct concepts. Model them as two STIX entities: alarms attached to a case become STIX Incidents, and the case itself becomes a STIX Case-Incident that references those Incidents through object_refs. Adds get_case_alarms to the client, create_incident plus risk-score mapping to the converter, and a dual collection loop. Tests and docs updated.
…t and docs
Emit a distinct OpenCTI TLP:CLEAR marking for tlp_level='clear' instead of
aliasing stix2.TLP_WHITE, and build TLP:AMBER+STRICT the same way via a shared
helper. Use a deterministic epoch fallback for missing/invalid timestamps so
Incident.generate_id / CaseIncident.generate_id stay stable and re-runs do not
create duplicate objects.
_request now fails fast on non-retriable 4xx (401/403/404) - only 429 and
network/5xx errors are retried - and logs context via meta={...}. The connector
marks its work to_processed in a finally so a failed run does not leave an
"in progress" work item hanging, and its docstring now reflects Case-Incidents.
Docs: mark scope / CONNECTOR_SCOPE as required in config.yml.sample,
docker-compose.yml and README.md; add 'white' to the tlp_level option list;
normalise the compose placeholders to ChangeMe. Tests: align the
_load_config_dict overrides with the SDK (-> Self), assert on str(err.value),
fix a grammar typo, and add TLP:CLEAR / deterministic-id / 4xx-fail-fast tests.
Review-and-fix pass summaryIndependent senior review of the full new connector plus all the open Copilot threads, fixed in Correctness (must-fix):
Robustness / consistency:
Verified locally: 39/39 unit tests pass; Remaining (non-CI) blocker: |
Proposed changes
This PR adds a new
EXTERNAL_IMPORTconnectorexternal-import/logrhythm-incidentsthat imports LogRhythm cases into OpenCTI as STIX Incidents. It is the import side
of a bidirectional LogRhythm integration (paired with the existing
stream/logrhythmconnector that feeds LogRhythm lists from OpenCTI)./lr-case-api/cases),capped per run.
severity, timestamps, external reference to the case number), attributed to a
LogRhythm author identity and marked with a configurable TLP.
connectors-sdksettings pattern, with unit tests andconnector metadata (manifest, config schema, configuration documentation).
Related issues
Closes #6728
Checklist
Type of change
Maintainer review and fix pass
Independent senior review of the full connector plus the Copilot threads.
Correctness:
converter_to_stix.py:tlp_level='clear'now emits a distinct OpenCTI TLP:CLEAR statement marking (x_opencti_definition='TLP:CLEAR') via a shared_custom_tlp()helper (which also builds TLP:AMBER+STRICT) instead of aliasingstix2.TLP_WHITE.converter_to_stix.py:_to_isouses a deterministic epoch fallback (1970-01-01) for missing/invalid timestamps soIncident.generate_id/CaseIncident.generate_idstay stable - the previousdatetime.now()fallback minted a new id (a duplicate object) on every run for records without a usable timestamp.api_client.py:_requestnow fails fast on non-retriable 4xx (401/403/404) - only 429 and network/5xx errors are retried - and passes context viameta={...}.connector.py: the work is markedto_processedin afinallyso a failed run no longer leaves an "in progress" work item hanging; the docstring now reflects that cases become Case-Incidents and their alarms become Incidents.Docs / consistency:
config.yml.sample,docker-compose.ymlandREADME.mdmarkscope/CONNECTOR_SCOPEas required; thetlp_leveloption list now includeswhite; the compose placeholders useChangeMe._load_config_dictoverrides return-> Self(matching the SDK), the settings test asserts onstr(err.value), a grammar typo is fixed, and tests were added for the TLP:CLEAR marking, the deterministic id, and the 4xx fail-fast path.The
apk update && apk upgradeDockerfile line is kept on purpose - it is the shared pattern across the repo's stream/external-import connectors; slimming those images should be a consistent, repo-wide change rather than a one-off here.Verified: 39/39 unit tests pass;
black/isort/flake8 --select=Fclean; all CI checks green (includingcodecov/patchandcodecov/project); 0 unresolved review threads. Commits are GPG-signed.Note:
mergeStateStatusis BLOCKED only because the PR needs an approving review from a maintainer other than me (I am the author and cannot self-approve).