Skip to content

Add OCSF to ASIM mapper#153

Merged
mavam merged 27 commits into
mainfrom
topic/ocsf-to-asim
Jun 13, 2026
Merged

Add OCSF to ASIM mapper#153
mavam merged 27 commits into
mainfrom
topic/ocsf-to-asim

Conversation

@mavam

@mavam mavam commented Jun 7, 2026

Copy link
Copy Markdown
Member

🔍 Problem

  • The Microsoft OCSF package emitted validated events but did not normalize them into ASIM.
  • Consumers needed flat ASIM records for alert, audit, authentication, process, user-management, and session workflows.

🛠️ Solution

  • Add microsoft::ocsf::map_to_asim with shared ASIM initialization and schema-specific dispatch.
  • Map supported OCSF classes to existing ASIM event shapes and fail strictly on unsupported classes in strict mode.
  • Add package tests and baselines for direct targets and representative source events.

💬 Review

  • The main tradeoff is coverage vs. exact field completeness; leftover OCSF data stays in AdditionalFields.
  • Review the class-to-schema dispatch and the inferred EventType mappings.

@mavam mavam marked this pull request as ready for review June 7, 2026 16:27
@tenzir tenzir deleted a comment from chatgpt-codex-connector Bot Jun 7, 2026
@mavam mavam force-pushed the topic/ocsf-to-asim branch from b50a092 to 4be2ad3 Compare June 8, 2026 10:13
mavam and others added 19 commits June 11, 2026 16:49
Map the Microsoft OCSF package into the ASIM event\nshapes it already emits, covering alert, audit, authentication,\nprocess, user-management, file, network, DNS, DHCP, and web\nsessions. Add strict failure coverage for unsupported classes and\nkeep the package tests aligned with the new mapper.

Assisted-by: GPT-5 (Codex)
Address review findings against the authoritative ASIM schema data
and OCSF 1.8 reference:

- Map OCSF Logoff activity to EventType Logoff instead of Logon.
- Read the URL from http_request.url.url_string so Url is a string,
  not a record, on conformant OCSF input.
- Preserve the full original OCSF event under AdditionalFields
  instead of a fixed metadata envelope that silently dropped
  unmapped payload fields.
- Normalize enumerated fields: ThreatCategory via lookup table with
  ThreatOriginalCategory, AlertVerdict to the four allowed values,
  Authentication EventSubType from logon_type with
  EventOriginalSubType, and Dns EventType from the query opcode with
  request/response EventSubType.
- Map severity_id 6 (Fatal) to High and stop passing arbitrary
  severity strings into EventSeverity.
- Orient rename events correctly: OCSF file becomes SrcFile* and
  file_result becomes TargetFile*.
- Derive ParentProcessId from the acting process's parent instead of
  the acting process itself.
- Honor OCSF start_time for EventStartTime.
- Drop the explicit unsupported class list in favor of the fallback.
- Make test fixtures OCSF-1.8-conformant (query.hostname,
  src_endpoint.mac, http_request.url) and add Logoff, rename, and
  logon_type coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assisted-by: Claude Opus 4.8 (Claude Code)
Expose microsoft::ocsf::map and microsoft::asim::map as the broad package entry points. Split the OCSF-to-ASIM implementation into class-level mappers under microsoft::asim::ocsf so future direct ASIM mappings can be added behind the stable API.

Assisted-by: GPT-5 (Codex)
Keep the new Microsoft mapping UDO frontmatter within the supported operator schema by using plain descriptions only.

Assisted-by: GPT-5 (Codex)
Treat Microsoft OCSF and ASIM dispatchers as current-event mappers and make raw payload preservation optional provenance.

Update Windows Event Log tests to parse XML explicitly before mapping and refresh their baselines.

Assisted-by: GPT-5 Codex (Superconductor)
Inline small finalization and unsupported branches instead of routing through helper UDOs.

Relax Account Change mapping so missing actor names stay nullable output fields rather than rejecting the event.

Assisted-by: GPT-5 Codex (Superconductor)
Snapshot the OCSF source event before creating the temporary ASIM working record, then use that snapshot when populating AdditionalFields.

This keeps implementation-only mapper state out of the preserved source event instead of dropping it after the fact.

Assisted-by: GPT-5 Codex (Superconductor)
Initialize ASIM OCSF mappers with separate ocsf and asim records, then read source fields through ocsf while building the ASIM output.

Keep the account-change class assertion before the common wrapper so it validates the original OCSF event shape.

Assisted-by: GPT-5 Codex (Superconductor)
Run the generic ASIM wrapper through OCSF normalization only when class_uid is absent, then always dispatch via the ASIM OCSF mapper with raw passthrough.

Initialize source and target namespaces in one assignment for Graph and Windows OCSF wrappers.

Assisted-by: GPT-5 Codex (Superconductor)
Add class_uid assertions to every ASIM OCSF leaf mapper so direct calls fail before common mapper setup when the source OCSF class is wrong.

Assisted-by: GPT-5 Codex (Superconductor)
Assert required source OCSF fields before common mapper setup instead of checking derived ASIM fields after mapping work has already run.

Assisted-by: GPT-5 Codex (Superconductor)
Keep class_uid guards on leaf mappers, but remove field-completeness assertions so supported OCSF classes can map whatever ASIM fields are available.

Assisted-by: GPT-5 Codex (Superconductor)
Simplify ASIM OCSF mapper conditionals by dropping redundant else-null branches and using explicit boolean comparisons for optional SID predicates.

Assisted-by: GPT-5 Codex (Superconductor)
Remove redundant fallback expressions now that optional spreads and nullable predicates are handled directly. Drop final select projections from the ASIM package tests so they validate the full mapped event shape.

Assisted-by: GPT-5 Codex (Superconductor)
Drop the raw-data side channel from the Microsoft OCSF and ASIM mapper UDOs. The mappers now use only the current event as their input, avoiding deferred argument semantics around moved fields.

Assisted-by: GPT-5 Codex (Superconductor)
Move the Microsoft OCSF-to-ASIM tests under the ASIM OCSF test tree so their layout mirrors the operator package. Split the broad user-management and direct-target cases into per-operator baselines.

Assisted-by: GPT-5 (Codex)
Require Microsoft map UDOs to write through an explicit event field. This makes OCSF and ASIM mapping composable with surrounding records and lets callers attach raw data outside the mapper without relying on deferred argument evaluation.

Assisted-by: GPT-5 Codex (Superconductor)
Make microsoft::asim::map expect OCSF input instead of hiding the Microsoft-to-OCSF conversion and OCSF derive/cast steps. Add examples that show the explicit OCSF-to-ASIM pipeline for Windows XML and Graph sign-ins.

Assisted-by: GPT-5 Codex (Superconductor)
Leave the Microsoft ASIM wrapper as an OCSF-only mapper for now, but document the intended source-to-ASIM bridge once OCSF derive and cast support field-targeted operation.

Assisted-by: GPT-5 Codex (Superconductor)
@mavam mavam force-pushed the topic/ocsf-to-asim branch from 7a8c2a5 to 83c2b18 Compare June 11, 2026 14:58
mavam added 7 commits June 11, 2026 17:10
Call the OCSF-to-ASIM mapper with this directly in the unsupported mapping fixture. Without strict, the assertion remains a warning instead of making the test expect a failing pipeline.

Assisted-by: GPT-5 (Codex)
Remove temporary event aliases from Microsoft examples and tests now that the mappers take a named event argument. Make mapper cleanup drops optional so direct event=this calls do not emit field-not-found warnings after the current event shape changes.

Assisted-by: GPT-5 (Codex)
Use move-based record construction when replacing mapper input with the final OCSF or ASIM event. This removes the separate cleanup drops for consumed intermediate namespaces.

Assisted-by: GPT-5 (Codex)
Emit only the mapped ASIM fields from OCSF-to-ASIM operators. Callers that need to retain the OCSF event can duplicate or copy it before invoking the ASIM mapper.

Assisted-by: GPT-5 (Codex)
Remove redundant class filters from per-schema ASIM OCSF tests. Keep only the records each fixture intends to map, and drop single-event sorts that no longer affect output order.

Assisted-by: GPT-5 (Codex)
Move the shared ASIM OCSF common mapper setup out of the helpers namespace. The package only has one helper UDO here, so callers can use microsoft::asim::ocsf::common directly.

Assisted-by: GPT-5 (Codex)
Route ASIM, Graph, and Windows mapping scratch state through the explicit event parameter instead of top-level temporary fields. This keeps nested mapping calls from leaking ocsf, asim, graph, or windows records into the caller scope.

Add scope regressions that map nested payloads and assert the outer fields remain untouched.

Assisted-by: GPT-5 (Codex)
Let the Microsoft public map UDOs use selector defaults for their event field parameter. Call sites that map the current record no longer need to spell out event=this, while nested selectors such as payload and win remain explicit.

Assisted-by: GPT-5 (Codex)
@mavam mavam merged commit 2a8bfca into main Jun 13, 2026
4 of 9 checks passed
@mavam mavam deleted the topic/ocsf-to-asim branch June 13, 2026 07:29
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