Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasets memcap tests/v2 #1909

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ def check_requires(requires, suricata_config: SuricataConfig):
elif key == "lambda":
if not eval(requires["lambda"]):
raise UnsatisfiedRequirementError(requires["lambda"])
elif key == "os":
inashivb marked this conversation as resolved.
Show resolved Hide resolved
if not sys.platform.startswith(requires["os"]):
raise UnsatisfiedRequirementError(requires["os"])
else:
raise Exception("unknown requires types: %s" % (key))

Expand Down
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
Loading