Skip to content

Conversation

kueken
Copy link
Collaborator

@kueken kueken commented Jul 21, 2025

Potential fix for https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/security/code-scanning/23

To fix the incomplete escaping, both backslashes (\) and single quotes (') must be escaped in the string, in that order (to avoid double-escaping the backslashes introduced during quote escaping). The best way to do this is to first replace every backslash (\) with a double backslash (\\), and then replace every single quote (') with a backslash-single-quote (\'). This ensures that any existing backslashes do not interfere with the escaping of single quotes, and that the resulting string is safe to insert into a single-quoted JavaScript or HTML attribute. The changes only need to be made in the region where desc.replace(/'/g,"\\'") is currently used (line 774). No new libraries are needed, and the code remains functionally unchanged except for the more robust escaping.


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

…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@kueken kueken marked this pull request as ready for review July 21, 2025 15:31
@kueken kueken merged commit 4fdba22 into master Jul 21, 2025
6 of 7 checks passed
@kueken kueken deleted the alert-autofix-23 branch July 21, 2025 15:32
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