Skip to content

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

Open
earlution wants to merge 1 commit into
mainfrom
alert-autofix-10
Open

Potential fix for code scanning alert no. 10: Client-side cross-site scripting#6
earlution wants to merge 1 commit into
mainfrom
alert-autofix-10

Conversation

@earlution

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/earlution/6-axis-compass/security/code-scanning/10

To fix this safely without changing functionality, ensure any untrusted values interpolated into HTML are escaped for HTML attribute context before being included in template strings used with innerHTML.

Best single fix: in src/merch.js, update buildMockupHTML so garmentId, garmentColor, and src are escaped before insertion into HTML attributes. Add a small local helper (e.g., escapeHtmlAttr) that replaces & < > " ' with entities. This keeps current rendering behavior while preventing attribute/context breaking and script injection.

Change region:

  • src/merch.js: around buildMockupHTML (lines 22–31 in provided snippet), inserting helper function above it and using escaped values in the returned template.

No other files are required for this fix.

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

…scripting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@earlution earlution marked this pull request as ready for review June 8, 2026 23:23
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