Skip to content

Conversation

@Dhruvacube
Copy link
Member

Potential fix for https://github.com/Creatrix-Net/creatrix-net.github.io/security/code-scanning/12

To fix the issue, the text extracted from el.textContent should be properly escaped before being inserted into the DOM as HTML. This ensures that any special characters in the text are treated as literal text rather than HTML or JavaScript. The best approach is to use a library or utility function to encode the text for safe HTML output.

Steps to fix:

  1. Replace the direct concatenation of title into the newLine string with an escaped version of title.
  2. Use a utility function to escape the text. For example, a simple function can replace special characters (<, >, &, ", ') with their corresponding HTML entities.
  3. Ensure that all text content inserted into innerHTML is escaped.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Dhruva Shaw <dhruvashaw@gmail.com>
@Dhruvacube Dhruvacube marked this pull request as ready for review June 15, 2025 18:51
@Dhruvacube Dhruvacube merged commit 283469d into master Jun 15, 2025
7 of 8 checks passed
@Dhruvacube Dhruvacube deleted the alert-autofix-12 branch June 15, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants