Skip to content

Conversation

@sapiderman
Copy link
Collaborator

Potential fix for https://github.com/hyperjumptech/whatsapp-chatbot-connector/security/code-scanning/3

To resolve the reflected XSS vulnerability, any data from req.query["hub.challenge"] incorporated into the response should be properly encoded before sending it to the client. Since the functionality requires echoing the challenge value, we should use output encoding to prevent execution of injected scripts. The best way in Node.js/Express is to use the well-known escape-html package, which escapes special HTML characters, neutralizing any embedded scripts. Amend the code so that before sending challenge back in the response (line 37), you encode it using escape-html. This requires importing the package and using it at the appropriate response location. All changes are confined to api/webhook.ts.

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

…ipting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@sapiderman sapiderman requested a review from raosan September 2, 2025 04:55
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.

2 participants