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

To fix the incomplete escaping bug in the escapeSelector function, we need to ensure that the backslash character itself is also escaped. This is accomplished by modifying the regular expression selectorEscape to include the backslash (\) as a character to be matched and escaped. In JavaScript regular expressions, a backslash must be double-escaped (\\\\) in the regex source to match a literal backslash. Update the regular expression so that it matches backslash as well as the existing set of special characters. No additional methods or imports are required; only the regex definition needs to be changed.

Specifically, edit the definition of selectorEscape on line 1564 to include the backslash, like so:
var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\\\]^{|}~])/g;`

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:18
@kueken kueken merged commit 9106ffa into master Jul 21, 2025
6 of 7 checks passed
@kueken kueken deleted the alert-autofix-24 branch July 21, 2025 15:19
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