Skip to content

Update debug.es6.js DOM Text Interpretd as html#44338

Closed
Shivam7-1 wants to merge 1 commit intojoomla:5.2-devfrom
Shivam7-1:patch-1
Closed

Update debug.es6.js DOM Text Interpretd as html#44338
Shivam7-1 wants to merge 1 commit intojoomla:5.2-devfrom
Shivam7-1:patch-1

Conversation

@Shivam7-1
Copy link
Contributor

@Shivam7-1 Shivam7-1 commented Oct 22, 2024

Summary of Changes

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 make page more safer as compare to innerHTML and prevent cross-site scripting (XSS) vulnerabilities by treating the input as plain text rather than interpreted HTML.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.2-dev labels Oct 22, 2024
@Shivam7-1 Shivam7-1 changed the title Update debug.es6.js DOM Text Inter[retd as html Update debug.es6.js DOM Text Interpretd as html Oct 22, 2024
@HLeithner
Copy link
Member

This won't work as we inject HTML on purpose here.

@HLeithner HLeithner closed this Oct 22, 2024
@Shivam7-1
Copy link
Contributor Author

Hii @HLeithner
Thanks For Reviewing 😃
Can here use dompurify for sanitize the HTML Which won't Change innerhtml behaviour and also It will get more Secure Also ?

How is it ?
Regards

@dgrammatiko
Copy link
Contributor

Can here use dompurify for sanitize the HTML

You could use

Joomla.sanitizeHtml = (unsafeHtml, allowList, sanitizeFn) => {
const allowed = (allowList === undefined || allowList === null)
? DefaultAllowlist : { ...DefaultAllowlist, ...allowList };
return sanitizeHtml(unsafeHtml, allowed, sanitizeFn);
};

@Shivam7-1
Copy link
Contributor Author

Shivam7-1 commented Oct 25, 2024

Hii @dgrammatiko @HLeithner Thanks For Suggestions
Accordingly I had Done Here #44342
Could You Please Review This PR
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NPM Resource Changed This Pull Request can't be tested by Patchtester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments