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
Improve the logging/noticing of Legacy REST API usages #43851
Conversation
Hi @lsinger, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Test Results SummaryCommit SHA: db80f0d
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Closing and re-opening to trigger the CI checks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests as intended -- the notices appear with correct links and the IP address is added to the logs.
I left two comments, one of which I think we should address (the sanitization one), but I'm open to arguments against as well.
Co-authored-by: Leif Singer <leif@automattic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my comments -- still tests well and I have no further comments.
37515de
to
db80f0d
Compare
* Include request IP address in the logging of Legacy REST API usages * Add link to the Legacy REST API plugin to the usage notices
Changes proposed in this Pull Request:
This pull request expands on #40535, #40866 and #41804 by adding the following improvements:
Add the IP address of the requester to the generated log entries.
Replace the "an extension will be available" text with "an extension is available", including a link to the extension in the WordPress.org plugins directory, in the usages detected notices and in the Legacy REST API settings page notices:
How to test the changes in this Pull Request:
First, if you have tested the pull requests mentioned above, you'll probably have dismissed the relevant notices; you'll need to undo the dismissals first:
If you have the separate Legacy REST API extension installed, you need to at least disable (or uninstall if you prefer) it.
Make sure to have the Legacy REST API activated in settings, and to have webhooks that depend on the Legacy REST API (see the testing instructions in the other pull requests welcome); and force the recreation of the notices:
wp eval 'WC_Admin_Notices::reset_admin_notices();'
Now go to the Legacy REST API settings page, you should see three Legacy REST API warnings (two dismissable notices, and one paragraph under the setting, as in the screenshot above); verify that all the links in those work as expected.
Finally, repeat the testing instructions of #41804 and verify that the log entries contain the IP address of the requester.
Changelog entry
Significance
Type
Message
Improve the logging/noticing of Legacy REST API usages
Comment