From e7634a8c0cbb1e1f6df16536646683db6d224426 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 6 Apr 2026 13:01:45 +0000 Subject: [PATCH 1/3] feat: add snort data syntax support for pm operator Agent-Logs-Url: https://github.com/corazawaf/coraza/sessions/2ebb487b-5f51-4c42-b857-602201c80801 Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com> --- internal/operators/pm.go | 93 +++++++++++++++++++++++++++-- internal/operators/testdata/pm.json | 35 +++++++++++ 2 files changed, 122 insertions(+), 6 deletions(-) diff --git a/internal/operators/pm.go b/internal/operators/pm.go index 35e5b3244..717fc919e 100644 --- a/internal/operators/pm.go +++ b/internal/operators/pm.go @@ -6,6 +6,8 @@ package operators import ( + "fmt" + "strconv" "strings" ahocorasick "github.com/petar-dambovaliev/aho-corasick" @@ -18,8 +20,9 @@ import ( // multi-pattern searching. Matches space-separated keywords or patterns provided as arguments. // // Arguments: -// Space-separated keywords or patterns to match. Supports Snort data syntax like "A|42|C|44|F" -// for hex notation. All patterns are converted to lowercase for case-insensitive matching. +// Space-separated keywords or patterns to match. Supports Snort data syntax where raw bytes +// can be embedded using pipe-delimited hex notation, e.g. "A|42|C" or "|0d 0a|". +// All patterns are converted to lowercase for case-insensitive matching. // // Returns: // true if any of the patterns are found in the input, false otherwise @@ -31,6 +34,9 @@ import ( // // # Match multiple attack patterns // SecRule ARGS "@pm