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

Fix code scanning alert no. 2: DOM text reinterpreted as HTML #39

Closed
wants to merge 1 commit into from

Conversation

davidsneighbour
Copy link
Owner

Fixes https://github.com/davidsneighbour/hugo-darkskies/security/code-scanning/2

To fix the problem, we need to ensure that any user input is properly sanitized before being inserted into the HTML. This can be achieved by using textContent instead of innerHTML for inserting plain text, and by properly escaping any dynamic content that is inserted into the HTML.

  • Replace the use of innerHTML with textContent for plain text.
  • Use a function to escape any dynamic content that needs to be inserted into the HTML.

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

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Patrick Kollitsch <[email protected]>
@davidsneighbour davidsneighbour deleted the alert-autofix-2 branch February 9, 2025 19:10
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.

1 participant