Repository navigation
fix(security): escape SMS text written to order notes - #166
Merged
Merged
Conversation
SMS text can contain customer-supplied values such as {billing_name}.
It was stored unescaped in private order notes, which are rendered as
HTML on the order screen and the Dokan vendor dashboard. Escape the
note text with esc_html() via a new Base::escape_note() helper in both
the notification note and the manual order SMS note. The SMS body sent
to the gateway is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SMS text can include customer-supplied values (e.g.
{billing_name}). Texty stored that text unescaped in private WooCommerce order notes, which are rendered as HTML on the admin order screen and the Dokan vendor dashboard.This PR escapes the note text before it is saved. The SMS body sent to the gateway is unchanged.
Changes
includes/Notifications/WC/Base.php: newBase::escape_note()helper (esc_html,@since TEXTY_VERSION);add_sms_note()uses it, covering all automatic WC notifications.includes/OrderSms.php:add_note()escapes the stored note too. Thecontentreturned to the order-screen box stays plain text, since it is appended withtextContent.Notes
Testing
composer phpcspasses