Skip to content

Commit

Permalink
fix: improve accuracy of tests (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
EsadCetiner committed Mar 14, 2024
1 parent fa64d8b commit 4c81734
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 389 deletions.
52 changes: 5 additions & 47 deletions tests/regression/roundcube-rule-exclusions-plugin/9519101.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ meta:
name: 9519101.yaml
tests:
- test_title: 9519101-1
desc: Disable CRS for password login
desc: Logging into roundcube
stages:
- stage:
input:
Expand All @@ -15,53 +15,11 @@ tests:
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
Content-Type: application/x-www-form-urlencoded
port: 80
method: POST
uri: /post?_task=login&_pass=<script>
uri: /post?_task=login
data: |
_token=randomtoken&_task=login&_action=login&_timezone=Australia%2FSydney&_url=empty&_user=emptypostmaster%40example.com&_pass=empty%3Cscript%3E
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"
12 changes: 6 additions & 6 deletions tests/regression/roundcube-rule-exclusions-plugin/9519103.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ meta:
name: 9519103.yaml
tests:
- test_title: 9519103-1
desc: Disable 932236 for _task when set to mail"
desc: Viewing mailbox"
stages:
- stage:
input:
Expand All @@ -16,12 +16,12 @@ tests:
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
method: get
uri: /get?_task=mail&_mbox=INBOX
output:
no_log_contains: id "932236"
- test_title: 9519103-2
desc: Disable 932236 for _task when set to settings"
desc: Viewing settings"
stages:
- stage:
input:
Expand All @@ -31,7 +31,7 @@ tests:
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
method: get
uri: /get?_task=settings&_action=preferences
output:
no_log_contains: id "932236"
12 changes: 8 additions & 4 deletions tests/regression/roundcube-rule-exclusions-plugin/9519104.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ meta:
name: 9519104.yaml
tests:
- test_title: 9519104-1
desc: Disable 932236 for _token parameter, but only within a certain character range
desc: Disable 932236 for _token parameter
stages:
- stage:
input:
Expand All @@ -17,11 +17,13 @@ tests:
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
uri: /post
data: |
_token=lsrandom&_task=login&_action=login&_timezone=Australia%2FSydney&_url=empty&_user=postmaster%40example.com&_pass=%3Cscript%3E
output:
no_log_contains: id "932236"
- test_title: 9519104-2
desc: Disable 942450 for _token parameter, but only within a certain character range
desc: Disable 942450 for _token parameter
stages:
- stage:
input:
Expand All @@ -32,6 +34,8 @@ tests:
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
uri: /post
data: |
_token=0x0800random&_task=login&_action=login&_timezone=Australia%2FSydney&_url=empty&_user=postmaster%40example.com&_pass=%3Cscript%3E
output:
no_log_contains: id "942450"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tests:
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
method: GET
uri: /get?_task=mail&_framed=1&_uid=42&_mbox=INBOX&_framed=1&_action=headers
output:
no_log_contains: id "921180"
227 changes: 29 additions & 198 deletions tests/regression/roundcube-rule-exclusions-plugin/9519114.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ meta:
name: 9519114.yaml
tests:
- test_title: 9519114-1
desc: Disable 921180 for ARGS_NAMES:_id sending an email
desc: Sending an email
stages:
- stage:
input:
Expand All @@ -15,203 +15,34 @@ tests:
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
Content-Type: application/x-www-form-urlencoded
port: 80
method: POST
uri: /post?_task=mail&_action=send&_id=1&_id=2
uri: /post?_task=mail&_unlock=loading1709858237830&_framed=1
data: |
_token=random
_task=mail
_action=send
_id=106014434365ea5da745fb3
_attachments=empty
_from=1
_to=postmaster@example.com,
_cc=empty
_bcc=empty
_replyto=empty
_followupto=empty
_subject=<script>
_draft_saveid=empty
_draft=empty
_is_html=0
_framed=1
_message=<script>
editorSelector=plain
_mdn=empty
_dsn=empty
_keepformatting=empty
_priority=0
_store_target=Sent
output:
no_log_contains: id "921180"
- test_title: 9519114-2
desc: Disable 921180 for ARGS_NAMES:_id composing 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&_action=compose&_id=1&_id=2
output:
no_log_contains: id "921180"
- test_title: 9519114-3
desc: Disable 921180 for ARGS_NAMES:_framed sending 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&_action=send&_framed=1&_framed=2
output:
no_log_contains: id "921180"
- test_title: 9519114-4
desc: Disable 921180 for ARGS_NAMES:_framed composing 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&_action=compose&_framed=1&_framed=2
output:
no_log_contains: id "921180"
- test_title: 9519114-5
desc: Disable 921180 for ARGS_NAMES:_task sending 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&_action=send&_task=mail
output:
no_log_contains: id "921180"
- test_title: 9519114-6
desc: Disable 921180 for ARGS_NAMES:_task composing 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&_action=compose&_task=mail
output:
no_log_contains: id "921180"
- test_title: 9519114-7
desc: Disable 921180 for ARGS_NAMES:_action sending 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&_action=send&_action=send
output:
no_log_contains: id "921180"
- test_title: 9519114-8
desc: Disable 921180 for ARGS_NAMES:_action composing 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&_action=compose&_action=compose
output:
no_log_contains: id "921180"
- test_title: 9519114-9
desc: Disable 942131 for destination email address when composing 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&_action=compose&_to=Postmaster%20<postmaster@example.com>,
output:
no_log_contains: id "942131"
- test_title: 9519114-10
desc: Disable 942131 for destination email address when sending 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&_action=send&_to=Postmaster%20<postmaster@example.com>,
output:
no_log_contains: id "942131"
- test_title: 9519114-11
desc: Disable CRS for email subject sending 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&_action=send&_action=send&_subject=<script>
output:
no_log_contains: id "941101"
- test_title: 9519114-12
desc: Disable CRS for email subject composing 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&_action=compose&_action=compose&_subject=<script>
output:
no_log_contains: id "941101"
- test_title: 9519114-13
desc: Disable CRS for email message sending 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&_action=send&_action=send&_message=<script>
output:
no_log_contains: id "941101"
- test_title: 9519114-14
desc: Disable CRS for email message composing 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&_action=compose&_action=compose&_message=<script>
output:
no_log_contains: id "941101"
no_log_contains: |
id "(?:921180|941101|942131)"
Loading

0 comments on commit 4c81734

Please sign in to comment.