Skip to content

    Type a page, a command such as keryn scan, or a rule id.

    keryn detection validate

    Describes Keryn 0.5.2 and keryn-rules 0.8.0. Changelog

    View as Markdown

    Offline Sigma single-event replay with a sealed detection-quality receipt.

    keryn detection validate <input.json> <receipt.json | export.json>
    Usage: keryn detection replay <input.json> [--receipt <file|->] [--export <file>] [--timeout <seconds>]
    keryn detection replay --rule <rule.yml> --observations <batch.json>... [--labels <file>] [--save-input <file>] [...]
    keryn detection validate <input.json> <receipt.json | export.json>
    Offline replay of one Sigma single-event rule against supplied events (keryn-detection, profile sigma-replay-spike/0). The input is
    {rule, mapping: {id, observed}, events: [{id, event, label?}], source_complete?, cohort?}. The receipt records every event's verdict
    (match, no match, incomplete, refused; a no-match over an incomplete source is provisional) and precision and recall over the
    labelled events, each with its denominator, sealed by its own sha256. Aggregation, correlation and time windows are refused.
    --receipt <file|-> write the receipt (- prints it to stdout and the summary to stderr)
    --export <file> write the receipt as evidence: one item of a keryn-export/1 file, whose id is the sha256 of the receipt;
    validate takes that file in place of the receipt and refuses one changed since export
    --rule, --observations replay AI observation batches (keryn.dev/ai-observations/v1, what keryn ai-test saves) under the
    ai-observations-sigma/0 mapping: contract field names, application nested; a field the contract lacks
    (command lines, payloads, time) is incomplete; a batch not complete or with dropped events makes
    every no-match provisional. Event ids are run/case/trial/sequence.
    --labels <file> {"<event id>": "match" | "no_match"} for precision and recall
    --save-input <file> keep the composed replay input, which validate needs
    --timeout <s> stop the replay after this many seconds (default 60, at most 3600); it runs in a worker that is terminated
    validate re-runs the replay and compares: exit 0 valid, 1 not the receipt these inputs give, 2 unreadable.
    replay exits 0 when every event was decided, 3 when the rule was refused, an event was incomplete or refused, the source is
    declared incomplete, or the run was stopped (no receipt then). Nothing is collected or sent; a fixture cohort supports no
    production detection claim.
    Terminal window
    # Confirm a receipt someone handed you.
    keryn detection validate replay-input.json detection-receipt.json
    Code Meaning
    0 valid
    1 not the receipt these inputs give
    2 an input or receipt that cannot be read