From 288f43520369fc5137d72085b701791169f5900a Mon Sep 17 00:00:00 2001 From: Ricardo Valdes Date: Wed, 16 Sep 2026 20:34:28 -0400 Subject: [PATCH] fix: align Generic Input filter and rule contracts --- filters/audits/generic.md | 40 +++++++++++++++++++ filters/generic/generic.yml | 2 +- .../testdata/filter-contracts/generic.json | 22 ++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 filters/audits/generic.md create mode 100644 plugins/alerts/testdata/filter-contracts/generic.json diff --git a/filters/audits/generic.md b/filters/audits/generic.md new file mode 100644 index 000000000..709838ddc --- /dev/null +++ b/filters/audits/generic.md @@ -0,0 +1,40 @@ +# Generic Input normalization and rule review + +Use the SDK fieldName key so message extraction is retained. + +This draft targets UTMStack `v11`. It contains 1 filter changes +and 0 rule changes for this technology only. Review covered +1 filter configurations and 1 matching shipped rule files. +Unchanged rules are listed in the regression manifest; they are not duplicated in the diff. + +## Contract and validation + +- Compared exact standard names/types with go-sdk v1.1.31 and the supplied UTMStack dictionaries. +- Checked documented pipeline ordering, rename/move behavior, open vendor log fields, + event-side versus alert-side fields, and surviving fields used by affected rule predicates/history/grouping. +- Strict SDK configuration decoding and actual CEL compilation pass for this scope. +- 1 synthetic normalization cases pass, including SDK Event conversion and any + trigger predicate assertions recorded in the manifest. +- The scoped alerts module tests and `git diff --check` pass with the shared contract runner applied. + +The shared alert-contract PR supplies the reusable Go runner for the manifest in +`plugins/alerts/testdata/filter-contracts/generic.json`. Apply that support before running `go test ./...` in `plugins/alerts`. + +The model starts from synthetic extraction results. It does not run complex grok, +JSON/KV/XML/CSV extraction, time conversion, dynamic plugins, historical OpenSearch +queries, or the closed EventProcessor. Raw vendor logs and resulting alerts must +still be checked in staging before rollout. No customer false-positive reduction +has been measured and no production rollout is included. + +The one-field message capture is validated as a copy and the configuration decodes strictly against the SDK. + +## References + +- [SDK schema](https://github.com/threatwinds/go-sdk/blob/v1.1.31/plugins/plugins.proto) +- [Filter steps](https://github.com/threatwinds/go-sdk/wiki/Filter-Steps-Reference) +- [Standard event schema](https://github.com/threatwinds/go-sdk/wiki/Standard-Event-Schema) +- [Rule implementation](https://github.com/threatwinds/go-sdk/wiki/Implementing-Rules) + +`afterEvents`, empty noncapturing grok names, supported numeric strings, and custom +`log.*` fields are accepted. Existing textual protocol casing and vendor action names +are preserved unless a concrete consumer mismatch requires correction. diff --git a/filters/generic/generic.yml b/filters/generic/generic.yml index 5dd70cdd9..0220def80 100644 --- a/filters/generic/generic.yml +++ b/filters/generic/generic.yml @@ -6,7 +6,7 @@ pipeline: steps: - grok: patterns: - - field_name: log.message + - fieldName: log.message pattern: '(.*)' source: raw - json: diff --git a/plugins/alerts/testdata/filter-contracts/generic.json b/plugins/alerts/testdata/filter-contracts/generic.json new file mode 100644 index 000000000..479903257 --- /dev/null +++ b/plugins/alerts/testdata/filter-contracts/generic.json @@ -0,0 +1,22 @@ +{ + "technology": "Generic Input", + "filters": [ + "filters/generic/generic.yml" + ], + "rules": [ + "rules/generic/generic/cross_source_lateral_movement.yml" + ], + "fixtures": [ + { + "name": "generic_message_capture", + "filter": "generic/generic.yml", + "input": { + "raw": "unstructured test message" + }, + "expected": { + "log.message": "unstructured test message", + "raw": "unstructured test message" + } + } + ] +}