-
Notifications
You must be signed in to change notification settings - Fork 17
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
Security fix: Improved escaping for JSON attributes and structured data #218
Conversation
Backport of WC commit 7def966
Codecov Report
@@ Coverage Diff @@
## master #218 +/- ##
============================================
- Coverage 40.82% 40.82% -0.01%
Complexity 13447 13447
============================================
Files 367 367
Lines 51277 51286 +9
============================================
Hits 20936 20936
- Misses 30341 30350 +9
Continue to review full report at Codecov.
|
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 file includes/admin/helper/class-wc-helper.php
Has functions we cleaned out as we made cc leaner by removing the woo services subscriptions and their API checks since we have no way of knowing what’s going on the other end of the line. Those still need to be out.
TestingThe changes in this PR are related to escaping JSON attributes and structured data and it's difficult to carry out any meaningful manual testing. Nevertheless, I've carried out some testing including:
In addition, all existing Travis tests have passed. Do we need to create any further automated tests? |
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.
I compared this diff against woocommerce/woocommerce@7def966 and all looks good apart from the two minor comments I noted above.
Two files were modified in the upstream commit but not here - includes/admin/helper/class-wc-helper-updater.php
because we removed this file, and includes/admin/helper/class-wc-helper.php
because we removed all of the code that was updated in the upstream commit. So the way this was done is correct.
Do we need to create any further automated tests?
I think if we do the following then we will be about as ready as we can be:
- Compare the diffs against the corresponding WC commits
- Keep the current Travis build passing
- Do more extensive manual testing after all security fixes are merged
in includes/wc-formatting-functions.php Co-Authored-By: James Nylen <[email protected]>
As per corresponding WC commit: woocommerce/woocommerce@7def966#diff-74ce9b72ea9f1b5b22481be8d8349d54R15
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.
Poor @SInCE gets a lot of pings 😂
This looks good to me.
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.
Manual Testing done affected files
- on setup using the admin wizard
- Setup products that are variable
- Get reports on sales
Tests pass.
Backport of woocommerce/woocommerce@7def966.
See #214.
Files changed
includes/class-wc-structured-data.php
includes/wc-formatting-functions.php
includes/admin/class-wc-admin-pointers.php
includes/admin/class-wc-admin-setup-wizard.php
includes/admin/class-wc-admin-assets.php
includes/admin/helper/class-wc-helper.php
includes/admin/meta-boxes/views/html-product-data-variations.php
includes/admin/reports/class-wc-admin-report.php
includes/admin/reports/class-wc-report-coupon-usage.php
includes/admin/reports/class-wc-report-customers.php
includes/admin/reports/class-wc-report-sales-by-category.php
includes/admin/reports/class-wc-report-sales-by-product.php
includes/admin/reports/class-wc-report-sales-by-date.php
includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php
includes/widgets/class-wc-widget-layered-nav.php
includes/api/legacy/v1/class-wc-api-json-handler.php
includes/api/legacy/v2/class-wc-api-json-handler.php
includes/api/legacy/v3/class-wc-api-json-handler.php
templates/single-product/add-to-cart/variable.php
tests/unit-tests/util/class-wc-tests-core-functions.php
One additional file was excluded:
includes/admin/helper/class-wc-helper-updater.php (see #218 (review) below)