Skip to content

test(wazuh): validate event IDs and duplicate alerts across replay and rotation #410

Open

Description

@blitzcrieg1

Problem

The Wazuh discussion asks whether rereading a rotated or replayed Agentmetry
trail can create a second alert for the same recorded detection:
wazuh/wazuh#41217 (comment)

Integration under review: wazuh/integrations#127

A persisted detection event keeps its canonical event_id when the same record
is reread or copied unchanged. This is an event identity, not a deterministic
finding identity: generating another detection event can assign a new UUID.
The Wazuh localfile path reads the trail directly, bypassing Agentmetry's
network forwarder. The submitted Wazuh rules do not explicitly deduplicate by
event.event_id. Duplicate-alert behavior on replay and rotation is untested.

Validation follow-up

  • Prepare an isolated Wazuh manager and agent reading a synthetic trail.
    Record exact versions and distinguish this path from manager-only file reading.
  • Write expected outcomes and alert counts before running, and record the
    expectation file's hash. Use only synthetic records and harmless actions.
  • Deliver an original detection record, then append the exact same record
    again. Compare decoded source IDs and count actual Wazuh alerts.
  • Rotate the watched file and continue with a new record. Check for loss
    and rereads using source IDs, rather than Wazuh-generated alert IDs.
  • Replay a copy of the earlier record after rotation or reader restart.
    Record whether Wazuh emits another alert with the same source ID.
  • Use a distinct-event control with the same rule and correlation scope but
    a different event ID. Confirm it is not mistaken for a duplicate delivery.
  • Include routine tool activity as a non-alerting control.
  • Document the observed delivery and duplicate-alert contract. A stable
    source ID alone must not be described as exactly-once alerting.

Safety and status

NOT RUN. This issue records a test plan, not validation results or a
deduplication implementation. No model-driven test is required. Run from an
unhooked terminal with scratch data, a synthetic profile, explicit Agentmetry
settings and full-argument capture off. Do not load a real .env, install hooks,
use the live recorder or copy real account information or trails. Check the
real trail guard before and after the eventual test and stop on contamination.
If no isolated Wazuh backend is available, keep its status NOT RUN. Any
implementation follow-up must be tracked separately; do not alter frozen
detection files for this validation.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions