]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
pgsql: add test for copy in mode 2540/head
authorJuliana Fajardini <jufajardini@oisf.net>
Thu, 1 May 2025 16:21:04 +0000 (13:21 -0300)
committerJuliana Fajardini <jufajardini@oisf.net>
Wed, 4 Jun 2025 18:15:39 +0000 (15:15 -0300)
Task #7645

tests/pgsql/pgsql-copy-data-in/README.md [new file with mode: 0644]
tests/pgsql/pgsql-copy-data-in/TLPW-Jason-copyfrom-small.pcap [new file with mode: 0644]
tests/pgsql/pgsql-copy-data-in/suricata.yaml [new file with mode: 0644]
tests/pgsql/pgsql-copy-data-in/test.yaml [new file with mode: 0644]

diff --git a/tests/pgsql/pgsql-copy-data-in/README.md b/tests/pgsql/pgsql-copy-data-in/README.md
new file mode 100644 (file)
index 0000000..8d30e28
--- /dev/null
@@ -0,0 +1,10 @@
+A simple test for the CopyIn sub-protocol/ mode for PGSQL
+
+Checks only for the most relevant PGSQL messages from the pcap
+
+PCAP provided by Jason Ish.
+
+Redmine ticket
+
+https://redmine.openinfosecfoundation.org/issues/7645
+
diff --git a/tests/pgsql/pgsql-copy-data-in/TLPW-Jason-copyfrom-small.pcap b/tests/pgsql/pgsql-copy-data-in/TLPW-Jason-copyfrom-small.pcap
new file mode 100644 (file)
index 0000000..984dc71
Binary files /dev/null and b/tests/pgsql/pgsql-copy-data-in/TLPW-Jason-copyfrom-small.pcap differ
diff --git a/tests/pgsql/pgsql-copy-data-in/suricata.yaml b/tests/pgsql/pgsql-copy-data-in/suricata.yaml
new file mode 100644 (file)
index 0000000..bade989
--- /dev/null
@@ -0,0 +1,18 @@
+%YAML 1.1
+---
+
+outputs:
+  - eve-log:
+      enabled: yes
+      filetype: regular
+      filename: eve.json
+      types:
+        - pgsql:
+            passwords: false
+
+app-layer:
+  protocols:
+    pgsql:
+      enabled: yes
+      stream-depth: 0
+
diff --git a/tests/pgsql/pgsql-copy-data-in/test.yaml b/tests/pgsql/pgsql-copy-data-in/test.yaml
new file mode 100644 (file)
index 0000000..742814d
--- /dev/null
@@ -0,0 +1,29 @@
+requires:
+  min-version: 8
+
+args:
+- -k none
+
+checks:
+- filter:
+    count: 6
+    match:
+      event_type: pgsql
+- filter:
+    count: 1
+    match:
+      event_type: pgsql
+      pcap_cnt: 17
+      pgsql.tx_id: 4
+      pgsql.request.simple_query: "COPY tmp FROM STDIN"
+      pgsql.response.copy_in_response.columns: 13
+- filter:
+    count: 1
+    match:
+      event_type: pgsql
+      pcap_cnt: 21
+      pgsql.tx_id: 5
+      pgsql.request.copy_data_in.msg_count: 1
+      pgsql.request.copy_data_in.data_size: 2779
+      pgsql.request.message: "copy_done"
+      pgsql.response.command_completed: "COPY 5"