Skip to content

Conversation

@hdamecharla
Copy link
Member

Potential fix for https://github.com/Azure/sap-automation-qa/security/code-scanning/1

To fix the problem, we need to ensure that any text content derived from the DOM is properly escaped before being reinserted as HTML. This can be achieved by using a text node instead of setting innerHTML directly. We will create text nodes for the JSON keys and values to ensure that any special characters are properly escaped.

  • Replace the direct assignment to innerHTML with the creation of text nodes.
  • Update the formatJSON function to use text nodes instead of constructing HTML strings.

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

…s HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@hdamecharla hdamecharla marked this pull request as ready for review March 21, 2025 05:28
@hdamecharla hdamecharla requested a review from a team as a code owner March 21, 2025 05:28
@hdamecharla hdamecharla requested review from devanshjainms and dhruvmicrosoft and removed request for dhruvmicrosoft March 21, 2025 05:28
Copy link
Contributor

@devanshjainms devanshjainms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this security issue.

@devanshjainms devanshjainms merged commit 077cbc8 into main Mar 21, 2025
11 checks passed
@devanshjainms devanshjainms deleted the alert-autofix-1 branch March 21, 2025 05:29
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.

3 participants