-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Address Book Bug] Template filter \Magento\Framework\Filter\Template
cannot deal with improper input
#39353
Comments
Hi @wubinworks. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Bravo. Thank you for working on this issue.
|
Hi @wubinworks, Thanks for your reporting and collaboration. We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots. Customer input got parsed in Address Book and also in Customer view in admin. But it is working fine in Admin side addresses Hence Confirming the issue. Thanks. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-13341 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Bravo. Thank you for verifying the issue. |
Preconditions and environment
User input value such as
{{var firstname}}
is parsed in Address Book.Steps to reproduce
Magento 2.4.7 + use the system default HTML Address Template
Company:
{{if city}}{{var city}}, {{/if}}
Street Address(street1):
{{var firstname}}{{var lastname}}{{var country}}
Expected result
The displayed address should be what the customer input.
{{something}}
should not be parsed.Actual result
Customer input got parsed.
Additional information
The cause is this line Template.php#L317.
str_replace
is dangerous when you don't know what will be replaced, how many times the original string will be modified.The best way is to sanitize the user input. The "deferred directives" may not be reliable because you still cannot control the user input value.
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: