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

fix: false positive related to navigation menu update #47

Merged
merged 3 commits into from
Jun 26, 2024
Merged

fix: false positive related to navigation menu update #47

merged 3 commits into from
Jun 26, 2024

Conversation

azurit
Copy link
Member

@azurit azurit commented Jun 24, 2024

Fixes #46.

@EsadCetiner
Copy link
Member

@azurit You've missed the other false positive op reported for json.content, could you expand 9507140 to include /wp-json/wp/v2/navigation/?

@azurit
Copy link
Member Author

azurit commented Jun 25, 2024

@EsadCetiner Hm, what about to join rules 9507146 and 9507140 into one?

@EsadCetiner
Copy link
Member

@azurit Normally I would, but in this case the restricted headers has to be kept in sync with crs-setup.conf and it won't respect any additional restricted headers added by an end user. I'd rewrite 9507146 similar to 9507144 so it doesn't have to be kept in sync with any changes made by CRS, and it respects changes made by end users. It's easier to expand the regex to cover more endpoints vs having to remember to keep something in sync, especially if this happens with multiple plugins.

@azurit
Copy link
Member Author

azurit commented Jun 25, 2024

Ok, that makes sense.

@azurit
Copy link
Member Author

azurit commented Jun 26, 2024

@EsadCetiner Ready to merge?

@EsadCetiner
Copy link
Member

@azurit Are you going to rewrite 9507146 like how I suggested to reduce the maintenance of that rule, or do you have a better idea?

SecRule REQUEST_FILENAME "@rx /wp-json/wp/v[0-9]+/(?:posts|pages|users|templates|navigation)" \
    "id:9507146,\
    phase:1,\
    pass,\
    t:none,\
    nolog,\
    ver:'wordpress-rule-exclusions-plugin/1.0.1',\
    chain"
-   SecRule REQUEST_METHOD "@streq POST" \
+   SecRule &REQUEST_HEADERS:x-http-method-override "!@eq 0" \
        "t:none,\
-        setvar:'tx.restricted_headers_basic=/content-encoding/ /proxy/ /lock-token/ /content-range/ /if/ /x-http-method/ /x-method-override/'"
+        ctl:ruleRemoveById=920450"

@azurit
Copy link
Member Author

azurit commented Jun 26, 2024

I misunderstood you, done.

@EsadCetiner EsadCetiner merged commit 78c21af into coreruleset:master Jun 26, 2024
3 checks passed
@gene1wood gene1wood mentioned this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive on WordPress - Operation: Navigation menu update
2 participants