]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
http: adds another test for http.request_header keyword 1652/head
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 14 Feb 2024 21:16:28 +0000 (22:16 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 16 Feb 2024 05:45:38 +0000 (06:45 +0100)
Ticket: 6483

tests/http-request-header-multi/README.md [new file with mode: 0644]
tests/http-request-header-multi/input.pcap [new file with mode: 0644]
tests/http-request-header-multi/test.rules [new file with mode: 0644]
tests/http-request-header-multi/test.yaml [new file with mode: 0644]

diff --git a/tests/http-request-header-multi/README.md b/tests/http-request-header-multi/README.md
new file mode 100644 (file)
index 0000000..96f720d
--- /dev/null
@@ -0,0 +1,12 @@
+# Test Description
+
+Test `http.request_header` keywords with multiple rules
+
+## PCAP
+
+From https://redmine.openinfosecfoundation.org/issues/6483
+
+
+## Related issues
+
+https://redmine.openinfosecfoundation.org/issues/6483
diff --git a/tests/http-request-header-multi/input.pcap b/tests/http-request-header-multi/input.pcap
new file mode 100644 (file)
index 0000000..50283dd
Binary files /dev/null and b/tests/http-request-header-multi/input.pcap differ
diff --git a/tests/http-request-header-multi/test.rules b/tests/http-request-header-multi/test.rules
new file mode 100644 (file)
index 0000000..6e4d2a0
--- /dev/null
@@ -0,0 +1,6 @@
+## contains trailing |0d 0a| in pcre and does not fire, and should not fire, but when this rule is enabled, causes sid:3 to not fire
+alert http any any -> any any (flow:established,to_server; http.method; content:"GET"; http.uri; content:"/ws"; endswith; http.user_agent; content:"Go|2d|http|2d|client|2f|1|2e|1"; http.connection; content:"Upgrade"; bsize:7; http.request_header; content:"Key|3a 20|"; startswith; pcre:"/^(?:[a-z0-9]{64})\x0d\x0a/R"; sid:2;)
+
+## doesn't contain |0d 0a|, should fire and fires by itself, but not when above rule is enabled.
+alert http any any -> any any (flow:established,to_server; http.method; content:"GET"; http.uri; content:"/ws"; endswith; http.user_agent; content:"Go|2d|http|2d|client|2f|1|2e|1"; http.connection; content:"Upgrade"; bsize:7; http.request_header; bsize:69; content:"Key|3a 20|"; startswith; pcre:"/^(?:[a-z0-9]{64})$/R"; sid:3;)
+
diff --git a/tests/http-request-header-multi/test.yaml b/tests/http-request-header-multi/test.yaml
new file mode 100644 (file)
index 0000000..69e5800
--- /dev/null
@@ -0,0 +1,17 @@
+requires:
+  min-version: 7
+
+args:
+  - -k none
+
+checks:
+  - filter:
+      count: 0
+      match:
+        event_type: alert
+        alert.signature_id: 2
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        alert.signature_id: 3