Skip to content

[Cases] Add cases.observablesAdded workflow trigger - #288224

Draft
kelvtanv wants to merge 1 commit into
mainfrom
kelvtanv/cases-observables-added-trigger
Draft

[Cases] Add cases.observablesAdded workflow trigger#288224
kelvtanv wants to merge 1 commit into
mainfrom
kelvtanv/cases-observables-added-trigger

Conversation

@kelvtanv

Copy link
Copy Markdown
Contributor

Summary

Adds a new Tech Preview workflow trigger cases.observablesAdded that fires after one or more observables are successfully added to a case.

Closes elastic/security-team#19051

Trigger details

ID: cases.observablesAdded
Stability: tech_preview

Payload

Field Type Description
event.caseId string The ID of the case
event.owner string The owner/solution (e.g. securitySolution)
event.observables array Newly-persisted observables
event.observables[].id string Observable ID
event.observables[].typeKey string Type key (e.g. ip, hash.md5)
event.observables[].value string Observable value (e.g. 1.2.3.4)
event.observables[].description string | null Optional description

Emission paths

Path Covers
applyObservablesToCase Auto-extraction from alert/event attachments; cases.addObservables workflow step; Agent Builder tool
addObservable Manual single-add via POST /internal/cases/{id}/observables

Only newly-added observables are in the payload — existing observables that were re-submitted as duplicates are excluded via id-based diff. Nothing is emitted when every submitted observable already exists on the case.

Design note: payload includes value

Unlike cases.extendedFieldsUpdated (which omits field values), this trigger intentionally includes event.observables[].value. The issue specifies this, and enrichment workflows (the primary use case — VirusTotal, MISP lookups) need the value to operate. Reviewers should be aware that workflow authors without Cases read access can observe case observable values through trigger payloads.

Loop prevention

A workflow using cases.addObservables re-emits this trigger. The docs include a guard example with on.workflowEvents: ignore.

Changes

  • cases/common/workflows/triggers/index.ts — new observablesAddedTriggerCommonDefinition
  • cases/server/events/types.ts + event_bus.ts — new event-bus event
  • cases/server/client/cases/observables.ts — emit after patchCase in both write paths
  • cases/server/client/cases/observables_trigger_utils.ts (new) — emit helper
  • cases/server/workflows/triggers/event_bridge.ts + index.ts — bridge + registration
  • cases/public/workflows/triggers/observables_added.ts (new) — public definition
  • workflows_extensions/test/.../approved_trigger_definitions.ts — approval fixture

Testing

  • All unit tests pass: event bus round-trip, trigger utils mapping, observables emit (add + apply), event bridge forwarding
  • node scripts/type_check --project x-pack/platform/plugins/shared/cases/tsconfig.json
  • node scripts/eslint --fix
  • node scripts/i18n_check --fix

Requesting review from @elastic/workflows-eng for trigger schema approval.


🤖 Generated with Claude Code

Adds a new tech-preview workflow trigger that fires after one or more
observables are successfully added to a case. This covers three paths:
- Manual add (UI or API, POST /internal/cases/{id}/observables)
- Auto-extraction from alert/event attachments (when extractObservables is on)
- The cases.addObservables workflow step / Agent Builder tool

The trigger payload carries caseId, owner, and the newly-persisted
observables (id, typeKey, value, description). Only newly-added
observables are included; nothing is emitted when all submitted
observables are duplicates.

Includes:
- Common trigger definition with eventSchema, i18n docs, and examples
- Server event-bus event (emitObservablesAdded / onObservablesAdded)
- Emission in applyObservablesToCase (id-based diff) and addObservable
- Workflow event bridge subscription and server/public registration
- Approval fixture entry (schemaHash verified)
- Unit tests for event bus, trigger utils, observables, and event bridge

Closes elastic/security-team#19051

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kelvtanv kelvtanv added release_note:enhancement backport:skip This PR does not require backporting Team:One Workflow Team label for One Workflow (Workflow automation) labels Aug 31, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown
🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

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

Labels

backport:skip This PR does not require backporting release_note:enhancement Team:One Workflow Team label for One Workflow (Workflow automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant