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

tests: add test for bug-7199 - v1 #2069

Closed
wants to merge 1 commit 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
15 changes: 15 additions & 0 deletions tests/bug-7199/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Test

Showcase change of behavior from Suricata-7.0.5 to Suricata-7.0.6.
Before, a non-stream rule that matched traffic associated with an app-layer
transaction would result in app-layer metadata being logged with the alert, if
metadata was enabled. Starting with 7.0.6, this will only be achieved if the
rule is an app-layer/stream one.

### Pcap

Packet capture resulting of a curl to suricata.io.

### Ticket

https://redmine.openinfosecfoundation.org/issues/7199
Binary file added tests/bug-7199/TLPW-curl-http-suricata.pcap
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/bug-7199/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%YAML 1.1
---

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
types:
- alert:
enabled: true
tagged-packets: true
metadata: true
http-body: true
- http:
extended: true
tagged-packets: true
- tls:
extended: true

4 changes: 4 additions & 0 deletions tests/bug-7199/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reject ip any any -> any any (msg: "Reject by AntreaNetworkPolicy:default/ingress-allow-http-request-to-api-v2"; flow: to_server, established; sid: 1;)
pass http any any -> any any (msg: "Allow http by AntreaNetworkPolicy:default/ingress-allow-http-request-to-api-v2"; http.uri; content:"/api/v2/"; startswith; http.method; content:"GET"; http.host; content:"foo.bar.com"; startswith; endswith; sid: 2;)
alert http any any -> any any (msg: "Alert by AntreaNetworkPolicy:default/ingress-allow-http-request-to-api-v2"; http.method; content:"GET"; sid: 3;)
reject http any any -> any any (msg: "Reject HTTP by AntreaNetworkPolicy:default/ingress-allow-http-request-to-api-v2"; flow: to_server, established; dsize: >0; sid: 4;)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, should we log the transaction if there is a alproto defined and if there is only one transaction ? (so we cannot be wrong)

52 changes: 52 additions & 0 deletions tests/bug-7199/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
args:
- -k none
- --set stream.midstream=true
- --simulate-ips

checks:
- filter:
count: 4
match:
event_type: alert
alert.signature_id: 1
- filter:
count: 0
match:
event_type: alert
alert.signature_id: 2
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 3
has-key: http
- filter:
min-version: 7.0.6
count: 1
match:
event_type: alert
alert.signature_id: 4
has-key: http
- filter:
min-version: 7.0.6
count: 4
match:
event_type: alert
alert.signature_id: 1
has-key: http
# starting with Suricata 7.0.6, app-layer transaction is only logged for
# stream rules
- filter:
lt-version: 7.0.6
count: 1
match:
event_type: alert
alert.signature_id: 4
has-key: http
- filter:
lt-version: 7.0.6
count: 4
match:
event_type: alert
alert.signature_id: 1
has-key: http
Loading