viewer/studio: escape texture preview URL and format in texture grid cards (VIEWER-STUDIO-TEXTURE-ESCAPE) #704
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!704
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/704/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@kirigayakazima on GitHub · 2026-11-24 12:25 UTC · original
kirigayakazima:fix/viewer-studio-texture-escape→main· +36 −4 · 2 files · 1 commits · merged 2026-11-24 14:37 UTCClaimed in the coordination issue as: VIEWER-STUDIO-TEXTURE-ESCAPE #14
What and why
In
viewer/studio.html(renderTexturesGrid),escapeHtmlwas applied tot.name, whilet.preview(src="...") andt.format(<span>...</span>) were interpolated raw intocard.innerHTMLin both the initial 80-card batch and the"show all"batch.A hostile
t.previewort.formatstring containing quotes/markup (for example"><img src=x onerror=alert(1)>) broke out of the HTML attribute/element and injected elements/event handlers. Escaping both fields withescapeHtml(t.preview)andescapeHtml(t.format)in both batches aligns them witht.nameand the model list inrenderAccordionList.Adds a synthetic regression test in
tests/test_viewer_studio.cjscovering bothpreviewandformatacross card 0 (initial batch) and card 80 ("show all"batch). No game files used.Tested
Windows 11 x64, Node v24.19.0, Python 3.14.7, CPU only, synthetic inputs only (no game files). Commit
9280ce0370ecbfe935a445e8cb125d1bdb9bfccf.node tests/test_viewer_studio.cjs:viewer/studio.html: new test fails with injected<img src=x onerror=alert(1)>tag intagShape(...);node tests/test_viewer_streaming.cjs: 57/57 passed, 0 failed.python -I tests/test_viewer_cdn_integrity.py: 10 tests, OK.python -I tests/test_ci_registration.py: 15 tests, OK.python -I tests/test_text_write_line_endings.py: 3 tests, OK.python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjsandgit diff --check: clean (exit0).GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)@abnalstlll-byte on GitHub · 2026-11-24 12:29 UTC · original · approved these changes
Reviewed and verified VIEWER-STUDIO-TEXTURE-ESCAPE. Escaping \ .preview\ in the <img>\ src attribute and \ .format\ in the texture metadata card with \escapeHtml()\ closes markup injection vectors in both initial and show-all batches. Unit test in \ ests/test_viewer_studio.cjs\ confirms tag shape stability and unescaped payload rejection. Approved.