Skip to content

Commit 76a559a

Browse files
committed
chore: apply review suggestions
1 parent dc07cd3 commit 76a559a

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Diff for: plugins/wordpress-rule-exclusions-before.conf

+6-7
Original file line numberDiff line numberDiff line change
@@ -497,33 +497,32 @@ SecRule REQUEST_FILENAME "@unconditionalMatch" \
497497
ver:'wordpress-rule-exclusions-plugin/1.0.1'"
498498

499499

500-
# Operator @unconditionalMatch is used instead of a SecAction because of a bug
501-
# in ModSecurity v3 which prevents SecActions to be removed using ctl action.
502-
# _wp_original_http_referer and referredby are used by the "Classic-Editor" plugin.
500+
# `_wp_original_http_referer` and `referredby` are used by the "Classic-Editor" plugin.
503501
# While we usually don't support plugins, this plugin restores previously existing
504502
# core functionality.
505-
SecRule REQUEST_FILENAME "@unconditionalMatch" \
503+
SecRule &ARGS_NAMES:_wp_original_http_referer|&ARGS_NAMES:referredby "@gt 0" \
506504
"id:9507355,\
507-
phase:1,\
505+
phase:2,\
508506
pass,\
509507
t:none,\
510508
nolog,\
511509
ctl:ruleRemoveTargetById=920273;ARGS:_wp_original_http_referer,\
512-
ctl:ruleRemoveTargetById=931130;ARGS:_wp_original_http_referer,\
513510
ctl:ruleRemoveTargetById=932235;ARGS:_wp_original_http_referer,\
514511
ctl:ruleRemoveTargetById=932236;ARGS:_wp_original_http_referer,\
515512
ctl:ruleRemoveTargetById=942120;ARGS:_wp_original_http_referer,\
516513
ctl:ruleRemoveTargetById=942430;ARGS:_wp_original_http_referer,\
517514
ctl:ruleRemoveTargetById=942431;ARGS:_wp_original_http_referer,\
518515
ctl:ruleRemoveTargetById=942432;ARGS:_wp_original_http_referer,\
519516
ctl:ruleRemoveTargetById=920273;ARGS:referredby,\
520-
ctl:ruleRemoveTargetById=931130;ARGS:referredby,\
521517
ctl:ruleRemoveTargetById=932235;ARGS:referredby,\
522518
ctl:ruleRemoveTargetById=932236;ARGS:referredby,\
523519
ctl:ruleRemoveTargetById=942120;ARGS:referredby,\
524520
ctl:ruleRemoveTargetById=942430;ARGS:referredby,\
525521
ctl:ruleRemoveTargetById=942431;ARGS:referredby,\
526522
ctl:ruleRemoveTargetById=942432;ARGS:referredby,\
523+
ctl:ruleRemoveTargetById=920273;ARGS_NAMES:_wp_original_http_referer,\
524+
ctl:ruleRemoveTargetById=920273;ARGS_NAMES:referredby,\
525+
ctl:ruleRemoveTargetById=920273;REQUEST_BODY,\
527526
ver:'wordpress-rule-exclusions-plugin/1.0.1'"
528527

529528

Diff for: tests/regression/wordpress-rule-exclusions-plugin/9507355.yaml

+11-6
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ tests:
1515
Host: localhost
1616
User-Agent: OWASP CRS test agent
1717
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
18+
Content-Type: application/x-www-form-urlencoded
1819
port: 80
19-
method: GET
20+
method: POST
2021
version: "HTTP/1.1"
2122
uri: /wp-admin/post.php
22-
data: referredby=https://website.xyz/wp-admin/edit.php?s=user&post_status=all&post_type=post&action=-1&m=0&cat=0&post_format&paged=1&action2=-1
23+
data: referredby=https%3A%2F%2Fwebsite.xyz%2Fwp-admin%2Fedit.php%3Fs%3Duser%26post_status%3Dall%26post_type%3Dpost%26action%3D-1%26m%3D0%26cat%3D0%26post_format%26paged%3D1%26action2%3D-1
2324
output:
24-
no_log_contains: id "932235"
25+
no_log_contains: |-
26+
id "920273"|id "932235"|id "932236"|id "942120"|id "942430"|id "942431"|id "942432"
27+
2528
- test_title: 9507355-2
2629
desc: Create new post with classic editor (`_wp_original_http_referer`)
2730
stages:
@@ -32,10 +35,12 @@ tests:
3235
Host: localhost
3336
User-Agent: OWASP CRS test agent
3437
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
38+
Content-Type: application/x-www-form-urlencoded
3539
port: 80
36-
method: GET
40+
method: POST
3741
version: "HTTP/1.1"
3842
uri: /wp-admin/post.php
39-
data: _wp_original_http_referer=https://website.xyz/wp-admin/edit.php?s=user&post_status=all&post_type=post&action=-1&m=0&cat=0&post_format&paged=1&action2=-1
43+
data: _wp_original_http_referer=https%3A%2F%2Fwebsite.xyz%2Fwp-admin%2Fedit.php%3Fs%3Duser%26post_status%3Dall%26post_type%3Dpost%26action%3D-1%26m%3D0%26cat%3D0%26post_format%26paged%3D1%26action2%3D-1
4044
output:
41-
no_log_contains: id "932235"
45+
no_log_contains: |-
46+
id "920273"|id "932235"|id "932236"|id "942120"|id "942430"|id "942431"|id "942432"

0 commit comments

Comments
 (0)