Skip to content

Commit d22c6bb

Browse files
Andreas Herzcatenacyber
authored andcommitted
tests: add test to verify unmatched signatures does not write to dataset
Related to https://redmine.openinfosecfoundation.org/issues/5576
1 parent f27b795 commit d22c6bb

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Description
2+
3+
Test datasets only sets when there is a full signature match.
4+
5+
# Ticket
6+
7+
https://redmine.openinfosecfoundation.org/issues/5576
1.88 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# this will not match, and thus not write to the dataset
2+
alert http any any -> $HOME_NET any (msg:"HTTP learning"; flow:established,to_client; http.content_type; content:"noone"; http.server; content:"ECS"; fast_pattern; dataset:set,http_none,type string,state output/none.intel; sid:2; rev:1; priority:2;)
3+
# this will match, and thus write to the dataset
4+
alert http any any -> $HOME_NET any (msg:"HTTP learning"; flow:established,to_client; http.content_type; content:"ocsp"; http.server; content:"ECS"; fast_pattern; dataset:set,http_match,type string,state output/match.intel; sid:3; rev:1; priority:2;)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
requires:
2+
min-version: 8
3+
4+
args:
5+
- -k none
6+
7+
checks:
8+
# only sid 3 should trigger
9+
- filter:
10+
count: 1
11+
match:
12+
event_type: alert
13+
alert.signature_id: 3
14+
- filter:
15+
count: 0
16+
match:
17+
event_type: alert
18+
alert.signature_id: 2
19+
# data should only be written to one dataset
20+
- shell:
21+
args: cat none.intel | wc -l | xargs
22+
expect: 0
23+
- shell:
24+
args: cat match.intel | wc -l | xargs
25+
expect: 1

0 commit comments

Comments
 (0)