Skip to content

Commit

Permalink
datasets: add tests for string memcap
Browse files Browse the repository at this point in the history
Ticket 3910
  • Loading branch information
inashivb committed Jun 28, 2024
1 parent 3221f0e commit 94df372
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/datasets-memcap-01/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test Description
================

This test demonstrates that the memcap settings DO NOT take the string length into account in 7.0.x or below.

PCAP
====

Comes from existing test `flowbit-oring`.

Related tickets
===============

https://redmine.openinfosecfoundation.org/issues/3910
1 change: 1 addition & 0 deletions tests/datasets-memcap-01/datasets.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Y3VybC83LjQzLjA=
1 change: 1 addition & 0 deletions tests/datasets-memcap-01/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (http.user_agent; dataset:isset,ua-seen,type string,load datasets.csv,memcap 88074,hashsize 1; sid:1;)
18 changes: 18 additions & 0 deletions tests/datasets-memcap-01/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pcap: ../flowbit-oring/input.pcap

requires:
lt-version: 8

args:
- -k none

checks:
- filter:
count: 1
match:
event_type: alert
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1
14 changes: 14 additions & 0 deletions tests/datasets-memcap-02/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test Description
================

This test demonstrates that the memcap settings take the string length into account in 8.0.x.

PCAP
====

Comes from existing test `flowbit-oring`.

Related tickets
===============

https://redmine.openinfosecfoundation.org/issues/3910
1 change: 1 addition & 0 deletions tests/datasets-memcap-02/datasets.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Y3VybC83LjQzLjA=
1 change: 1 addition & 0 deletions tests/datasets-memcap-02/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (http.user_agent; dataset:isset,ua-seen,type string,load datasets.csv,memcap 88074,hashsize 1; sid:1;)
15 changes: 15 additions & 0 deletions tests/datasets-memcap-02/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pcap: ../flowbit-oring/input.pcap

requires:
min-version: 8
os: linux

exit-code: 1

args:
- -k none

checks:
- shell:
args: grep "dataset too large for set memcap" suricata.log | wc -l
expect: 1

0 comments on commit 94df372

Please sign in to comment.