Skip to content

Commit

Permalink
test: create regression tests for all rules (#14)
Browse files Browse the repository at this point in the history
* Create integration.yml

* Create lint.yml

* test: create regression test for 9519100

* test: create 9519101, 9519102, 9519103 and 9519104 regression tests

* test: fix newline

* test: fix failing tests

* test: fix failing tests

* test: fix failing tests

* test: create 9519101, 9519102, 9519103 and 9519104 regression tests

* test: fix newline

* test: fix failing tests

* test: fix 9519102-2 failing test

* test: fix failing tests

* test: create 9519111 and 9519112 regression tests

* test: fix lint

* test: fix newline character

* test: create 9519113, 9519114 and 9519115 regression tests

* test: fix lint and create 9519116 regression test

* test: fix too many blank lines

* test: create 9519130, 9519150, 9519151 and 9519152 regression tests

* test: create 9519153, 9519154, 9519155 and 9519156 regression tests
  • Loading branch information
EsadCetiner authored Dec 31, 2023
1 parent efef407 commit ca69b87
Show file tree
Hide file tree
Showing 21 changed files with 967 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
on: [push, pull_request]

jobs:
integration-tests:
uses: coreruleset/crs-plugin-test-action/.github/workflows/integration.yaml@main
6 changes: 6 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
on: [push, pull_request]

jobs:
plugin-lint:
uses: coreruleset/crs-plugin-test-action/.github/workflows/lint.yaml@main
87 changes: 87 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519100.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519100.yaml
tests:
- test_title: 9519100-1
desc: Disable 932236 for roundcube_sessid cookie
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
cookie: roundcube_sessid=dfjsdia80f
port: 80
method: POST
uri: /post
output:
no_log_contains: id "932236"
- test_title: 9519100-2
desc: Disable 932236 for roundcube_sessauth cookie
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
cookie: roundcube_sessauth=dfjsdia80f
port: 80
method: POST
uri: /post
output:
no_log_contains: id "932236"
- test_title: 9519100-3
desc: Disable 932236 for identviewsplitter cookie name
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
cookie: identviewsplitter=foo
port: 80
method: POST
uri: /post
output:
no_log_contains: id "932236"
- test_title: 9519100-4
desc: Disable 942450 for roundcube_sessid cookie
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
cookie: roundcube_sessid=0x0800
port: 80
method: POST
uri: /post
output:
no_log_contains: id "942450"
- test_title: 9519100-5
desc: Disable 942450 for roundcube_sessauth cookie
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
cookie: roundcube_sessauth=0x0800
port: 80
method: POST
uri: /post
output:
no_log_contains: id "942450"
67 changes: 67 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519101.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519101.yaml
tests:
- test_title: 9519101-1
desc: Disable CRS for password login
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=login&_pass=<script>
output:
no_log_contains: id "941110"
- test_title: 9519101-2
desc: Disable 921180 for ARGS_NAMES:_task when logging in
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=login&_task=login
output:
no_log_contains: id "921180"
- test_title: 9519101-3
desc: Disable 921180 for ARGS_NAMES:_framed when logging in
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=login&_framed=1&_framed=1
output:
no_log_contains: id "921180"
- test_title: 9519101-4
desc: Disable 921180 for ARGS_NAMES:_action when logging in
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=login&_action=1&_action=1
output:
no_log_contains: id "921180"
23 changes: 23 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519102.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519102.yaml
tests:
- test_title: 9519102-1
desc: Disable 932237 and 932239 for referrers if the referrer is valid
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
referer: https://example.com/?_task=settings
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post
output:
no_log_contains: id "932237"
37 changes: 37 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519103.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519103.yaml
tests:
- test_title: 9519103-1
desc: Disable 932236 for _task when set to mail"
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=mail
output:
no_log_contains: id "932236"
- test_title: 9519103-2
desc: Disable 932236 for _task when set to settings"
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=settings
output:
no_log_contains: id "932236"
37 changes: 37 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519104.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519104.yaml
tests:
- test_title: 9519104-1
desc: Disable 932236 for _token parameter, but only within a certain character range
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_token=dfdf
output:
no_log_contains: id "932236"
- test_title: 9519104-2
desc: Disable 942450 for _token parameter, but only within a certain character range
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_token=0x800
output:
no_log_contains: id "942450"
23 changes: 23 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519111.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519111.yaml
tests:
- test_title: 9519111-1
desc: Disable 953101 for response body
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post
data: "maximum allowed file size is 10MB"
output:
no_log_contains: id "953101"
39 changes: 39 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519112.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519112.yaml
tests:
- test_title: 9519112-1
desc: Disable 951220 for response body when viewing an email
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: GET
uri: /get?_task=mail
data: "SqlException"
output:
no_log_contains: id "951220"
- test_title: 9519112-2
desc: Disable 951230 for response body when viewing an email
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: GET
uri: /get?_task=mail
data: "MySqlClient."
output:
no_log_contains: id "951230"
22 changes: 22 additions & 0 deletions tests/regression/roundcube-rule-exclusions-plugin/9519113.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
meta:
author: "Esad Cetiner"
description: "Roundcube Rule Exclusions Plugin"
enabled: true
name: 9519113.yaml
tests:
- test_title: 9519113-1
desc: Disable 921180 for ARGS_NAMES:_framed when viewing an email
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: Roundcube rule exclusions plugin
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
port: 80
method: POST
uri: /post?_task=mail&_framed=1&_framed=1
output:
no_log_contains: id "921180"
Loading

0 comments on commit ca69b87

Please sign in to comment.