Skip to content

Potential fix for code scanning alert no. 8: Client-side cross-site scripting #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

austenstone
Copy link
Member

Potential fix for https://github.com/octodemo/jj-vulnerable-node/security/code-scanning/8

To fix the issue, the user-provided input (in_query) must be properly escaped before being rendered into the HTML. This can be achieved by replacing <%- in_query %> with <%= in_query %> in the EJS template. The <%= %> syntax escapes the content, ensuring that any special characters in the input are rendered as plain text rather than executable HTML or JavaScript.

Additionally, it is good practice to validate or sanitize the input at the source (in routes/products.js) to ensure that only expected and safe data is processed.


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

…cripting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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