Skip to content

Potential fix for code scanning alert no. 12: DOM text reinterpreted as HTML#159

Merged
Markj89 merged 2 commits into
developmentfrom
alert-autofix-12
May 23, 2025
Merged

Potential fix for code scanning alert no. 12: DOM text reinterpreted as HTML#159
Markj89 merged 2 commits into
developmentfrom
alert-autofix-12

Conversation

@Markj89
Copy link
Copy Markdown
Owner

@Markj89 Markj89 commented May 22, 2025

Potential fix for https://github.com/Markj89/cta-tracker/security/code-scanning/12

To fix the issue, we need to sanitize or escape the value retrieved from colNode.getAttribute('data-value') before storing it in the data object. This ensures that any potentially malicious input is neutralized and cannot be interpreted as executable code or HTML. A simple and effective way to sanitize the value is to use a library like DOMPurify or encode the value using a utility function that escapes HTML special characters.

The fix involves:

  1. Adding a utility function to escape HTML special characters.
  2. Applying this function to the val variable before storing it in the data object.

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

Markj89 and others added 2 commits May 21, 2025 23:44
…as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Markj89 Markj89 changed the base branch from master to development May 22, 2025 04:49
@Markj89 Markj89 marked this pull request as ready for review May 22, 2025 04:59
@Markj89 Markj89 merged commit be72c6d into development May 23, 2025
4 checks passed
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