Skip to content

Conversation

@robrien-bcgov
Copy link
Contributor

Fixes https://github.com/bcgov/bcgov-wordpress-block-theme/security/code-scanning/2

To fix the problem, we need to ensure that any text content used in constructing HTML is properly escaped to prevent XSS attacks. This can be achieved by using a function to escape HTML special characters before assigning the content to innerHTML.

  • Create a function to escape HTML special characters.
  • Use this function to escape headingCounter.innerText before including it in the HTML string.

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>
@robrien-bcgov robrien-bcgov self-assigned this Jan 8, 2025
@robrien-bcgov
Copy link
Contributor Author

I'll have to manually intervene here to get past the Lint errors triggered by the automated fix.

@robrien-bcgov robrien-bcgov marked this pull request as ready for review January 8, 2025 23:49
@robrien-bcgov robrien-bcgov deleted the alert-autofix-2 branch July 10, 2025 20:54
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