-
Notifications
You must be signed in to change notification settings - Fork 65
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
Update HtmlFilter.php DOM Text Interpreted As HTML #879
Conversation
Hii @engcom-Hotel Could You Please Take a look and Review Here in this PR ? |
@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.
@@ -98,7 +98,7 @@ public function filterHtml(string $content): string | |||
*/ | |||
private function getChildrenInnerHtml(\DOMElement $element): string | |||
{ | |||
$innerHTML = ''; | |||
$innerText = ''; |
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.
Please elaborate on the purpose of this change.
Also as I can see here you are just changing the variable name. If that is so then please update the same in line number 115 and 118:
$innerHTML .= $ownerDocument->saveXML($child); |
return $innerHTML; |
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.
Hii @engcom-Hotel Thanks For Reviewing Yes done this changes
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.
Also please help us with the purpose of this PR. In the actual codebase we are not using the innerHTML
property, here $innerHTML
is used as a variable. So this change doesn’t make any sense to me.
Please correct me if I am wrong.
@@ -98,7 +98,7 @@ public function filterHtml(string $content): string | |||
*/ | |||
private function getChildrenInnerHtml(\DOMElement $element): string | |||
{ | |||
$innerHTML = ''; | |||
$innerText = ''; |
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.
Also please help us with the purpose of this PR. In the actual codebase we are not using the innerHTML
property, here $innerHTML
is used as a variable. So this change doesn’t make any sense to me.
Please correct me if I am wrong.
Hii @engcom-Hotel Thank you for the feedback. You’re correct that |
Thanks @Shivam7-1, We are closing this PR as per your last comment.
|
Description
Here innerText can be used 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.
Checklist