-
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: Introduce file type check for tax rate importer #222
Conversation
Codecov Report
@@ Coverage Diff @@
## master #222 +/- ##
============================================
- Coverage 40.83% 40.81% -0.02%
- Complexity 13447 13449 +2
============================================
Files 367 367
Lines 51275 51292 +17
============================================
- Hits 20938 20936 -2
- Misses 30337 30356 +19
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.
Testing
|
On manual test of this file. I tried to add a .jpeg file and received the message below. Message below. Message expected: "Invalid file type. The importer supports CSV and TXT file formats." The change itself has no problem the expected changes for the user reflect otherwise in messaging. Uploading a CSV and txt allows for full upload as expected. We might have to re-fix this as CC. And also fix this issue in
If this change is adopted, we need to introduce the new file checker for csv and txt from |
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.
-
Why was
tests/unit-tests/util/conditional-functions.php
excluded from this change? -
I see the same behavior as @bahiirwa (the message is not the expected one), but otherwise the diff looks the same as woocommerce/woocommerce@737f6af. It's probably a good idea to test the same action using WooCommerce. If it behaves the same way then we should merge this and investigate separately.
|
I agree on the decision @timbocode took here. However, there a sample files in the repo that can be tested on the fly. This could be its on implementation. |
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.
Outside this #222 (comment) which we should consider seperately as well as add better message for the invalid file types
Manual tests passed:
- Add taxes manually ne by one
- Upload a csv and txt file with tax rates passes adding new tax rates.
Backport for woocommerce/woocommerce@737f6af
See also #214
Files affected:
includes/admin/importers/class-wc-product-csv-importer-controller.php
includes/admin/importers/class-wc-tax-rate-importer.php
includes/wc-conditional-functions.php
Files not included:
tests/unit-tests/util/conditional-functions.php