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/22

To fix the problem, we should escape both backslashes and single quotes in the station variable, so that the resulting string can be safely embedded in a single-quoted string literal in HTML or JavaScript. The general approach is to first replace all backslashes (\) with double backslashes (\\), then replace all single quotes (') with escaped single quotes (\'). This matches what is done on line 774 for desc. The fix should be applied on line 767, replacing the current station.replace(/'/g,"\\'") with station.replace(/\\/g, '\\\\').replace(/'/g,"\\'"). No additional imports or dependencies are required.


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:40
@kueken kueken merged commit 877d6a3 into master Jul 21, 2025
6 of 7 checks passed
@kueken kueken deleted the alert-autofix-22 branch July 21, 2025 15:40
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