Skip to content

[#1157] Native IrisMISP integration with the IRIS 3 IOC EnrichmentPanel - #7

Open
Marker689 wants to merge 3 commits into
dfir-iris:masterfrom
Marker689:feature/1157-native-ioc-enrichment
Open

Marker689 wants to merge 3 commits into
dfir-iris:masterfrom
Marker689:feature/1157-native-ioc-enrichment

Conversation

@Marker689

@Marker689 Marker689 commented Oct 27, 2026 •

Copy link
Copy Markdown

Problem

Issue dfir-iris/iris-web#1157: IrisMISP enriches IOCs only through the MISP Report HTML custom attribute. The IRIS 3 native enrichment panel (fed by ioc.ioc_enrichment) therefore stays empty even when MISP returns matches — the backend and frontend already support the presentation, only the module never feeds it.

What this PR does

Adds a normalisation layer (iris_misp_module/misp_handler/enrichment.py) that turns the MISP search results already returned by the module into the payload rendered by the IRIS 3 enrichment panel, and writes it to ioc.ioc_enrichment from the existing hook handler. The three triggers the module already supports (manual Get MISP insight, on-create and on-update hooks) all go through that handler, so all of them populate the panel.

The payload contains:

  • source misp (rendered as the "MISP" source in the panel),
  • a concise summary, match status and number of matching events,
  • the highest MISP threat level (1..4 mapped to high/medium/low/undefined),
  • tags and taxonomy classifications,
  • event identifiers, publishing organisations and related events,
  • one clickable link to the most relevant matching MISP event (most severe, then most recent); every event URL is kept in the raw JSON view,
  • the queried instances and the normalised events for the raw JSON view.

Behaviour details:

  • Other sources are preserved. Enrichment is merged into a copy of ioc.ioc_enrichment: keys written by other modules stay untouched, only the misp source is replaced, and a new dict is assigned (the JSONB column is not a MutableDict, so in-place mutation would not be persisted).
  • No invented verdict. A MISP match is not by itself a malicious verdict, as requested in the issue. The payload deliberately does not set verdict; the threat level and tags are reported instead, and the verdict is left to modules that can classify the IOC.
  • Legacy behaviour is unchanged. The MISP Report attribute and the misp:hit tag logic are untouched. The new Populate native IOC enrichment setting (misp_populate_enrichment, enabled by default) only controls the native enrichment; disabling it keeps the pre-IRIS-3 behaviour.
  • domain|ip is aggregated. The previous code handled the domain and IP halves with two separate report calls, so the second call would erase the domain findings from the enrichment. The enrichment is now built once from the merged domain/IP reports. The IP half also uses search_ip (IP attribute types) instead of search_domain, which missed IP-only MISP attributes.
  • Bounded payload. The raw events view is capped at 25 events so ioc.ioc_enrichment stays bounded (it is returned in IOC list/search responses); the complete raw results remain available in the MISP Report attribute.

Small robustness fixes on the touched paths: an invalid Jinja template now returns an I2Error status instead of raising out of the hook (enrichment is written before the legacy report rendering), and a MISP configuration that is valid JSON but not an object is rejected cleanly.

Module version bumped to 1.5.0 (IrisMISPConfig.py and setup.py). The module interface version is unchanged (1.2.0).

Why this is module-only

No backend or frontend change is needed, as confirmed against IRIS 3 backend/frontend:

  • IrisMISP hooks are registered asynchronously (the iris_interface default); the backend Celery hook wrapper merges the IOC into the session, calls the module handler and then commits — with an explicit "Recommit the changes made by the module" — so assigning ioc.ioc_enrichment from the module persists.
  • The frontend EnrichmentPanel/enrichment-view already renders any top-level source key with summary, link, verdict and scalar/scalar-list fields, mapping misp to the "MISP" label; nested objects (instances/events) are shown in the raw JSON dialog.

Tests

82 offline unit tests pass (python -m pytest iris_misp_module/tests -q): 52 pure mapping tests and 30 handler integration tests. They cover matched/no-match/malformed reports, multiple instances, threat-level mapping and selection, URL building, tag/classification extraction, list bounds and deduplication, merge semantics, domain|ip aggregation, disabled option, legacy attribute/tag paths, invalid template handling and non-object MISP configuration. The pymisp client is mocked and the IRIS backend imports are stubbed (tests/conftest.py), so no network or IRIS deployment is required.

The pre-existing tests were also repaired: they imported a top-level misp_handler package that only exists when the module is installed in the backend, and queried a real MISP instance, so they could not run outside an IRIS deployment.

Compatibility / release notes

  • Existing module configurations that do not contain misp_populate_enrichment keep working: the handler falls back to the enabled default. IRIS stores module configuration at registration time, so upgraded deployments may not show the new setting until the module configuration is refreshed; the feature itself is active by default.
  • IRIS default Docker deployments currently bundle iris_misp_module-1.3.0 in iris-backend. Companion PRs so the feature is delivered end to end:

PR base branch

The organisation CONTRIBUTING.md asks for PRs against develop, but this repository only has master (no develop branch exists), so this PR targets master. Maintainers may want to create the missing develop branch for future contributions.

Checklist

  • Issue linked (#1157)
  • Code style followed: license headers, no shebang in new files, f-strings, one import per line, underscore-prefixed private helpers, module-prefixed public functions
  • Semantic version bump for the module
  • Offline tests added and green; existing tests repaired
  • Legacy MISP Report attribute and tags preserved
  • Other enrichment sources preserved
  • No frontend/backend change required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant