Skip to content

fix: escape clip name in TableClipStrategy.DefaultXml#212

Merged
fuzzzerd merged 1 commit into
masterfrom
fuzzz/escape-table-clip-name
May 16, 2026
Merged

fix: escape clip name in TableClipStrategy.DefaultXml#212
fuzzzerd merged 1 commit into
masterfrom
fuzzz/escape-table-clip-name

Conversation

@fuzzzerd
Copy link
Copy Markdown
Owner

Problem

TableClipStrategy.DefaultXml interpolates the clip name straight into the <BaseTable name="…"> attribute without XML escaping (src/SharpFM.Model/ClipTypes/TableClipStrategy.cs:66). A name containing ", &, <, or > produces malformed XML; the resulting clip fails to re-parse and is dropped silently. End-users have no way to know punctuation in a name will corrupt their work.

Concrete reproduction: create a table named My "favorite" stuff. The generated seed is <BaseTable name="My "favorite" stuff">Parse returns ParseFailure.

Trust-boundary note: the clipboard is local, so this is data integrity, not a security boundary. The failure mode is silent and hard to diagnose.

Fix

Wrap clipName in XmlHelpers.XmlEscape (already in SharpFM.Model.Scripting) before interpolation. One-line change.

Audited the sibling strategies — ScriptClipStrategy, LayoutClipStrategy, OpaqueClipStrategy all take clipName but ignore it, so no further fixes needed here.

Tests

Table_DefaultXml_EscapesPunctuationInName — theory covering ", &, and <> cases. Asserts the seed round-trips through Parse and the resulting Table.Name matches the original input. Confirmed RED on master, GREEN with the fix.

@github-actions
Copy link
Copy Markdown

Test Results

✔️ Tests 1318 / 1318 - passed in 15.9s
✔️ Coverage 78.78% - passed with 70% threshold
📏 14734 / 17174 lines covered 🌿 4952 / 7816 branches covered
🔍 click here for more details

✏️ updated for commit e7c9ac8

@fuzzzerd fuzzzerd merged commit c14aa08 into master May 16, 2026
6 checks passed
@fuzzzerd fuzzzerd deleted the fuzzz/escape-table-clip-name branch May 16, 2026 14:29
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