Skip to content

test/subslice: Add test cases for subslice#2749

Open
jlucovsky wants to merge 1 commit intoOISF:masterfrom
jlucovsky:7672/2
Open

test/subslice: Add test cases for subslice#2749
jlucovsky wants to merge 1 commit intoOISF:masterfrom
jlucovsky:7672/2

Conversation

@jlucovsky
Copy link
Contributor

Issue: 7672

Add test cases for the subslice transform

Ticket

If your pull request is related to a Suricata ticket, please provide
the full URL to the ticket here so this pull request can monitor
changes to the ticket status:

Redmine ticket: 7672

# startswith, endswith, bsize
alert http any any -> any any (http.user_agent; content: "curl/7.64.1"; subslice: -10,3; content: "url"; startswith; endswith; bsize:3; sid:3;)
alert http any any -> any any (http.response_body; subslice: 28,14; content: "EICAR-STANDARD"; bsize: 14;startswith; endswith; sid:4;)
alert http any any -> any any (http.user_agent; content: "curl/7.64.1";subslice: -10,3; content: "url"; bsize: 3; startswith; endswith; sid:5;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the diff between sid 3 and 5 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch; will remove duplicate.

# empty buffer test: bsize:0 -- offset is past buffer length
alert http any any -> any any (http.accept; content: "*/*";subslice: 9, 2; bsize:0; sid:7;)

# offset + nbytes exceeds length, not truncating so buffer will be empty
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do not have tests with negative value for nbytes as documented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add.

Issue: 7672

Applies to versions 9+

Add test cases for the subslice transform, including some edge cases.

Test cases cover all use cases, including cases where truncate has
impact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires suricata pr Depends on a PR in Suricata

Development

Successfully merging this pull request may close these issues.

3 participants