-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Update details.js DOM text reinterpreted as HTML #38757
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
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @Shivam7-1. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
@magento run all tests |
@magento create issue |
Hi @Shivam7-1. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Hii @engcom-Charlie , @engcom-Dash @engcom-Bravo and @engcom-Hotel Could You Please Review This PR Thanks & Regards |
Hii @engcom-Charlie , @engcom-Dash @engcom-Bravo and @engcom-Hotel Could You Please Review This PR Thanks & Regards |
@magento run all 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.
app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details.js
Show resolved
Hide resolved
Hii @engcom-Hotel Thanks For Review But I think yes Using textContent is more beneficial here as it automatically ensures text is safely handled without risking HTML injection, unlike innerHTML. |
Hii @engcom-Hotel is there Anything Else is Required From My side to get this PR merge |
Hello @Shivam7-1, We have tried to reproduce the issue with the given manual testing scenarios with these PR changes but it seems the issue is not fixed. We have created the below products and added them to the cart: And then we checked in the front on the checkout page, we could see the product name below: Please recheck the changes and let us know if we missed anything. Thanks |
Hii @engcom-Hotel Thanks For Reviewing The purpose of replacing However, based on your testing, it seems some product names are still being impacted by how they're displayed (for example, the If this is the case, and the text content must allow HTML for formatting purposes, I recommend we explore using a solution like Please let me know how you'd like to proceed, and if moving forward with DOMPurify would be a viable solution for the project. https://www.freecodecamp.org/news/innerhtml-vs-innertext-vs-textcontent/ |
Hii @engcom-Hotel Could you please Review this PR again |
Hii @engcom-Hotel @engcom-Dash Thanks For Reviewing PR |
Hello @Shivam7-1, At this stage, no action is required from your side. The PR is currently in the testing bucket and will be progressed based on priority. We appreciate your patience. Thanks |
Hii @engcom-Hotel Thanks For Response If possible Could Team Fastrack the Process |
Hii @engcom-Hotel Could you Please ping tester here for testing and get merge this PR So it will get merge Soon |
Hii @engcom-Hotel Could you Assign or ping anyone from Team to Test this PR |
Hii @engcom-Hotel Just Follow Up on this PR |
Hi @Shivam7-1, Thanks for the collaboration & contribution! ❌ : QA FAILEDBefore: ✖️ ![]() ❌ Actual result After Fix ![]() The results were same even after taking the PR changes.Could you Please let us know if we are missing anything and elaborate the expected and actual results. Thanks. |
Hii @engcom-Bravo Thanks For Reviewing above it's working fine you can check this comments here #38757 (comment) |
Hii @engcom-Bravo Thanks For Testing Anything else is Required from my side |
Hi @Shivam7-1, Thanks for your Update. Could you please let us know the aim of the PR and the issue that is solving here with the help of this PR.As per this comment #38757 (comment) before and after PR changes there is no change as such. Kindly provide us detailed manual testing scenario to proceed further. Thanks. |
Hii @engcom-Bravo The aim of this PR is to mitigate the potential risk of HTML injection, particularly related to XSS (Cross-Site Scripting) vulnerabilities. In the original code, we were using By switching to Regarding the manual testing, here are the scenarios which could be tested to ensure functionality:
The changes mainly affect the way the input is handled in terms of security. While it might seem like there’s no visible change, this update significantly improves the security posture by preventing potential XSS attacks. Please let me know if you need further clarifications or additional tests! Thanks, |
Hii @engcom-Bravo anything else is required from my side for this PR |
Hii @engcom-Bravo anything else is required from my side for this PR |
Hii @engcom-Charlie , @engcom-Dash @engcom-Bravo and @engcom-Hotel Team now this PR is ready to merge i think since 1.5 month could team look into this Thanks |
Hi @Shivam7-1, Currently, no action is required from your side. The PR is currently in the testing bucket and team will pick this PR for further processing based on priority. Thank you for your patience. |
Hii @engcom-Charlie Thanks |
Hi @Shivam7-1, Team is currently working on the other priority board. Currently this PR is in Ready for Testing bucket and as mentioned above, no action is required from your end here. Team will pick it in future as per the priority. Thank you! |
Description (*)
By using textContent , it will avoid the risk of HTML injection, as these properties automatically escape any HTML special characters in the provided text. This helps prevent cross-site scripting (XSS) vulnerabilities by treating the input as plain text rather than interpreted HTML.
To help with the testing you can use the following manual testing scenarios:
Check if HTML tags are correctly escaped:
Add a product with various HTML tags (e.g.,
<b>bold</b>
,<script>alert("test")</script>
) in the cart, then verify that these are displayed correctly without being interpreted as HTML on the checkout page.Check edge cases with special characters:
Add products with special characters in their names (e.g.,
&
,<
,>
,"
). Ensure that these characters are correctly sanitized and displayed as expected.Contribution checklist (*)
Resolved issues: