Skip to content

fix(list_runtime_events): enable ML event discovery#67

Merged
tembleking merged 3 commits intosysdiglabs:mainfrom
ivanlysiuk-sysdig:fix/ml-events-discovery
Feb 27, 2026
Merged

fix(list_runtime_events): enable ML event discovery#67
tembleking merged 3 commits intosysdiglabs:mainfrom
ivanlysiuk-sysdig:fix/ml-events-discovery

Conversation

@ivanlysiuk-sysdig
Copy link
Contributor

@ivanlysiuk-sysdig ivanlysiuk-sysdig commented Feb 27, 2026

Problem

The list_runtime_events tool returned zero results when querying for ML-based detections (e.g. "Crypto Mining Detection" with engine = "machineLearning"), even though these events were visible in the Sysdig Secure UI.

The root cause was a source != "auditTrail" clause in the MCP baseFilter that duplicated a filter already applied by the events API. This duplication caused an OpenSearch query interaction that silently excluded ML events from the events_profiling_detection_v1 index.

Changes

  • Remove redundant source != "auditTrail" from the MCP baseFilter — the API already enforces this, so no audit trail events leak through
  • Document engine, source, and category as filterable attributes for ML detections
  • Add ML-specific filter examples (engine = "machineLearning", source = "agentless-aws-ml", etc.)
  • Fix baseFilter casing: "audittrail""auditTrail"
  • Document max limit of 200 events

Verification

Tested on both us2 and eu1 environments:

  • engine = "machineLearning" now returns ML events (Crypto Mining Detection confirmed)
  • source = "auditTrail" returns 0 events (API-side filter works correctly)
  • No audit trail event leakage across 2-week windows with 200k+ total events

…ilter casing

The list_runtime_events tool description and filter_expr docs did not
mention engine, source, or category attributes, causing AI agents to
query ML detections (e.g. crypto mining, anomalous logins) using
ruleName which returns no results. ML events use a separate content
structure and must be queried via engine="machineLearning" or
source="agentless-aws-ml"/"agentless-okta-ml".

Also fix baseFilter casing: "audittrail" -> "auditTrail" to match the
actual stored value.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copilot AI review requested due to automatic review settings February 27, 2026 03:09
@ivanlysiuk-sysdig ivanlysiuk-sysdig requested a review from a team as a code owner February 27, 2026 03:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug preventing AI agents from discovering ML-based security detections (crypto mining, anomalous logins) via the list_runtime_events tool, and corrects a filter casing issue that could have caused incorrect event filtering.

Changes:

  • Fixed baseFilter casing from "audittrail" to "auditTrail" to match actual stored values
  • Enhanced tool documentation to include engine, source, and category as queryable attributes for ML event discovery
  • Added explicit ML detection query examples and guidance

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/infra/mcp/tools/tool_list_runtime_events.go Updated baseFilter casing, enhanced tool description with ML detection support, added ML-specific attributes and filter examples
internal/infra/mcp/tools/tool_list_runtime_events_test.go Updated test expectation to match corrected auditTrail casing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…d ML events

The `source != "auditTrail"` clause in the MCP baseFilter duplicated
a filter already applied server-side, causing ML detections (e.g. Crypto
Mining Detection) to be silently excluded from results.
@tembleking tembleking changed the title fix(list_runtime_events): add ML event discovery and fix auditTrail filter casing fix(list_runtime_events): enable ML event discovery Feb 27, 2026
@tembleking
Copy link
Member

Tests do not pass because this is a fork and the secrets are not passed to the CI, but I can confirm that they are passing locally, so we can merge.

Copy link
Collaborator

@alecron alecron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tembleking tembleking merged commit d55ab69 into sysdiglabs:main Feb 27, 2026
4 of 5 checks passed
@tembleking tembleking mentioned this pull request Feb 27, 2026
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.

4 participants