-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Update js.phtml DOM text reinterpreted as HTML #38804
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 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 it's not yet Merged Thanks |
Hii @engcom-Charlie , @engcom-Dash @engcom-Bravo and @engcom-Hotel Could You Please Review This PR Thanks & Regards |
Hii @engcom-Hotel Could You Please Review This PR Thanks & Regards |
@magento run all tests |
Hii @engcom-Hotel any update on this PR ? |
@magento run all tests |
@magento run all tests |
Hi @Shivam7-1 Thanks for your PR. I have tested the changes using custom script and everything seems to be working fine from that angle. However, I am just curious to identify the exact area in the Magento admin where this code would have a direct impact. Could you please share some manual testing scenarios or specific place in the admin where this can be verified? That would really help ensure thorough testing. Also, the static tests are failing because ot the PR changes. Let me know if you are working on them. If not, Can I take care of the static failures? Appreciate you help! |
Hii @engcom-Dash Thank you for testing the changes and for your valuable feedback! Regarding your question about the Magento admin, the change I made to If you prefer to take care of the static failures, please feel free to do Thanks |
Hii @engcom-Dash any update on this PR? |
Hello @Shivam7-1, Thank you for your reply! I have tested the changes by adding the content with HTML special character, script in the product description and CMS Pages. Even after injecting a script with XSS vulnerabilities on product description or CMS page the script still renders instead of being treated as plain text. In case of HTML tag there is no visible difference on 2.4-develop & PR branch. It looks like the PR file changes doesn't have any visible effect on the product description or CMS page. Just to make sure I am validating the relevant functionality could you please share the exact manual test scenarios/steps and where this file is getting executed? Please find below screenshot with or without PR changes for product description: ![]() On PR Branch: patch-3 ![]() Thank You |
Hii @engcom-Dash I saw the feedback about no visible change. Just to clarify — the change from innerHTML to innerText is intentional for XSS prevention. we should keep such security updates even if they don’t result in visible UI changes |
@magento run all tests |
Hi @Shivam7-1, Thanks for the clarification! I understand that the change from innerHTML to innerText is intentional for XSS prevention. We actually tried addressing that via a custom script as well. I am just curious to know where exactly this file is getting rendered in the admin as it would help us better assess the impact of the change in various scenarios. Otherwise, applying this change alone might not have any practical effect. Appreciate your efforts on improving security! I have fixed the static test failures and since the functional test is failing moving this PR to Extended Testing. Thanks! |
Hii @engcom-Dash Thanks For Reviewing and Continous Support on this |
@magento run all tests |
@magento run Functional Tests B2B, Functional Tests EE, Functional Tests CE, Integration Tests |
Description (*)
By using innerText, 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.
Contribution checklist (*)
Resolved issues: