Skip to content
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 dom.ts DOM text reinterpreted as HTML #9440

Closed
wants to merge 1 commit into from

Conversation

Shivam7-1
Copy link

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.

@runspired
Copy link
Contributor

In this case we're clearing the DOM, never appending. Alternatives are setting via textContent or using element.replaceChildren(), though for the "clear all" case the difference is negligible. The only reason to avoid innerHTML would be if some security scanner that matters is particularly dogmatic about it, which .... they shouldn't be.

Setting via innerText isn't an alternative, it would behave differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants