mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #704] [MERGED] viewer/studio: escape texture preview URL and format in texture grid cards (VIEWER-STUDIO-TEXTURE-ESCAPE) #744
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#744
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/704
Author: @kirigayakazima
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:fix/viewer-studio-texture-escape📝 Commits (1)
9280ce0viewer/studio: escape texture preview URL and format in texture grid cards📊 Changes
2 files changed (+36 additions, -4 deletions)
View changed files
📝
tests/test_viewer_studio.cjs(+32 -0)📝
viewer/studio.html(+4 -4)📄 Description
Claimed in the coordination issue as: VIEWER-STUDIO-TEXTURE-ESCAPE https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131376751
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)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.