1-SEC contributors · Reviewed · Module: core

AI Agent Telemetry Gaps: Verify Event Arrival and Field Meaning

SecurityEvent is the shared envelope for typed observations.

What 1-SEC checks

SecurityEvent is the shared envelope for typed observations. Individual modules subscribe to event types and then read specific detail keys. An event can arrive successfully while still missing the information a particular detector needs.

Read the implementation: NewSecurityEvent

Required telemetry and context

This control uses an explicit configuration/API path rather than a standalone detector input event. Verify the caller and configuration before relying on its result.

  • type
  • source
  • source_ip
  • timestamp
  • details
  • agent_id and session context supplied by integration

Field names above describe relevant context, not a complete API request. Consult the current event contract for envelope and detail requirements. Preserve booleans, numbers, and strings as the receiving handler expects them. Agent-provided text cannot independently verify identity or authorization.

Deployment, prevention, and response

Trace one harmless known-positive fixture from the trusted producer through the event bus to its expected module alert. Retain the event identifier and verify the field types against the current schema. Add your integration's own health and delivery checks; do not invent a universal built-in missing-agent alarm. Have the MCP executor emit tool_call or function_call with stable agent, tool, action, and target values. Preserve a separate operation identifier, authorization result, and completion outcome in your audit system. Verify ordering and delivery through a benign fixture rather than counting all received events as completed actions.

Record the source event, affected agent/host, actual target, policy decision, and response result. Review enforcement configuration separately from detection. A recommendation, selected action, dry-run record, and completed action are different outcomes.

Reproduce the source fixtures

From a checkout of the linked 1-SEC source revision, run the selected fixtures with the repository's Go toolchain. These commands run tests; they do not execute a real attack against your systems.

go test ./internal/core -run '^(TestNewSecurityEvent_Fields)$' -count=1

The referenced source fixtures ran in the selected local package suites. Helper tests and synthetic events establish only the assertions shown, not production prevention or framework compatibility.

TestNewSecurityEvent_Fields

Full fixture and assertions — run in its original package with its helpers.

func TestNewSecurityEvent_Fields(t *testing.T) {
	ev := NewSecurityEvent("net_module", "port_scan", SeverityHigh, "Port scan detected")

	if ev.ID == "" {
		t.Error("ID should not be empty")
	}
	if ev.Module != "net_module" {
		t.Errorf("Module = %q, want %q", ev.Module, "net_module")
	}
	if ev.Type != "port_scan" {
		t.Errorf("Type = %q, want %q", ev.Type, "port_scan")
	}
	if ev.Severity != SeverityHigh {
		t.Errorf("Severity = %v, want High", ev.Severity)
	}
	if ev.Summary != "Port scan detected" {
		t.Errorf("Summary = %q, want 'Port scan detected'", ev.Summary)
	}
	if ev.Details == nil {
		t.Error("Details map should be initialised")
	}
	if ev.Timestamp.IsZero() {
		t.Error("Timestamp should be set")
	}
	if ev.Timestamp.Location().String() != "UTC" {
		t.Errorf("Timestamp should be UTC, got %v", ev.Timestamp.Location())
	}
}

Tuning, evaluation, and coverage limits

No alert is ambiguous: it can mean a benign case, missing content, wrong event type, dropped input, disabled module, or absent state. A healthy process and a green dashboard do not prove that a particular tool action was observed. For MCP invocation auditing, this establishes an event contract and detector observations only. It is not a complete signed, immutable, or lossless MCP transcript, and metadata registration events do not prove a tool invocation occurred.

Evaluate this behavior with representative authorized activity and a controlled known-positive case. Investigate the exact rule, inputs, and state before suppressing an alert. Do not assume a hard-coded heuristic is a configurable setting. Measure your own deployment; the source fixtures do not establish a benchmark, detection rate, compliance certification, or incident-prevention claim.

Related implemented controls

Implementation reviewed at source revision 2af8ea9dab2057a1ffc3cce9bf44220271fab18e. Recheck the actual release and integration before deployment. Sources and corrections policy.