-
Notifications
You must be signed in to change notification settings - Fork 8
Updated x-http-method-override rules for rest-api usage: #96
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
base: master
Are you sure you want to change the base?
Conversation
9ae6871 to
2ed4f03
Compare
|
@joostdekeijzer Can you fix errors? Thanks. |
2ed4f03 to
21afc04
Compare
Yes, I got a report from the workflow 😄 |
|
Thinking a bit more about this (while making my own installation support 3rd party plugins and custom development): With this patch, in a WordPress install "without permalinks" (rule 9507144) any POST to the WordPress REST API may use the x-http-method-override while WordPress installations "with permalinks" (rule 9507146) there is only limited support (only core WordPress requests). So:
Wouldn't it be most logical to have both rules support the same REST API requests? |
This is just an unintended side effect of the rule. if you want to, add an extra chain rule for |
|
I think I understand your "unintended side effect" argument. But, so I don't have to add a custom rule to my config for every WordPress site I host, I would like rule 9507146 to have the same "side effect" 😄 |
21afc04 to
8aad6fd
Compare
- 9507146 without permalinks (was 9507144) - 9507147 With permalinks (was 9507146) 1. Added test that REQUEST_METHOD *must be* POST 2. Added support for DELETE override 3. Added tests Please note that the WordPress developer docs state that any WordPress API call may use the x-http-method-override-header (see https://developer.wordpress.org/rest-api/using-the-rest-api/global-parameters/#_method-or-x-http-method-override-header) With current implementation eg. Custom Post Types are not supported.
8aad6fd to
d688e62
Compare
|
Updated due to fb32c34 renumbering. |
I understand the reasoning as to having the rules a bit laxer to allow for custom post types, can you open another PR for that? But this won't mean that we're supporting 3rd party plugins, we don't have the manpower to maintain and test all of these 3rd party plugins. |
9e63e6c to
7612818
Compare
|
I'll create another PR for relaxing the wp-json x-http-method-override rule after this PR (so they don't interfere). And I really do understand you don't want to open a door to supporting 3rd party plugins. |
@EsadCetiner thanks for the hints/suggestions. I get a linter error for rule 9507184 (around line 527) which I don't understand.
|
@joostdekeijzer Looks ready to merge, ignore the failure from the syntax check workflow it's broken. @airween Can you take a look at this https://github.com/coreruleset/wordpress-rule-exclusions-plugin/actions/runs/19062257393/job/54447882123?pr=96 valid syntax is being marked as invalid |
Tested for WordPress setup:
The permalink setup now works for:
^/([_0-9a-zA-Z-]+/)?wp-json/based on WordPress multisite .htaccess rule)http://mysite.com/wp-json/wp/v2/events/4693?_locale=user)The developer info states the header should only be used in POST requests, so added that requirement.