fix(html): reject unsupported children of text tags - #254
Merged
Merged
Conversation
53 tasks
LeadcodeDev
force-pushed
the
fix/html-shorthand-lengths
branch
from
September 22, 2026 06:11
342377a to
c0d2efd
Compare
LeadcodeDev
force-pushed
the
fix/html-text-children
branch
from
September 22, 2026 06:11
8eb5453 to
7fced5c
Compare
LeadcodeDev
force-pushed
the
fix/html-shorthand-lengths
branch
from
September 22, 2026 08:35
c0d2efd to
f36abbf
Compare
LeadcodeDev
force-pushed
the
fix/html-text-children
branch
from
September 22, 2026 08:35
7fced5c to
5b45306
Compare
LeadcodeDev
force-pushed
the
fix/html-shorthand-lengths
branch
from
September 22, 2026 08:45
f36abbf to
895d8e3
Compare
LeadcodeDev
force-pushed
the
fix/html-text-children
branch
from
September 22, 2026 08:45
5b45306 to
6717eb1
Compare
LeadcodeDev
changed the base branch from
fix/html-shorthand-lengths
to
chantier/audit-2026-09
September 22, 2026 08:53
LeadcodeDev
force-pushed
the
fix/html-text-children
branch
from
September 22, 2026 09:01
6717eb1 to
cc9f247
Compare
The `TagKind::Text` arm never calls `element_to_value` on its children, so the whole guard layer (`StyleElementUnsupported`, `UnsupportedNativeElement`, `TagKind::Ignored`) is unreachable below `p/span/h1..h6/strong/em/label`. Executed against the real crate: `<p>Real <script>var secret = 1; alert(2);</script></p>` transpiles to `{"content":"Real var secret = 1; alert(2);","type":"text"}` — the JS source is rendered on screen; `<h1>Title<style>h1{color:#0f0}</style></h1>` gives `{"content":"Titleh1{color:#0f0}"}`; `<p>cap<img src="hero.png"></p>`, `<h1>t<svg>…</svg></h1>` and `<span>n=<rm-counter from="0" to="100"></rm-counter></span>` drop the img/svg/counter entirely and exit 0. This is a live regression of "constat 1" and "constat 3", which tests/silent_loss_regressions.rs asserts are fixed — the fix only ever covered the `Container` path.
Refs #220
LeadcodeDev
force-pushed
the
fix/html-text-children
branch
from
September 22, 2026 09:06
cc9f247 to
36800b4
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
The `TagKind::Text` arm never calls `element_to_value` on its children, so the whole guard layer (`StyleElementUnsupported`, `UnsupportedNativeElement`, `TagKind::Ignored`) is unreachable below `p/span/h1..h6/strong/em/label`. Executed against the real crate: `<p>Real <script>var secret = 1; alert(2);</script></p>` transpiles to `{"content":"Real var secret = 1; alert(2);","type":"text"}` — the JS source is rendered on screen; `<h1>Title<style>h1{color:#0f0}</style></h1>` gives `{"content":"Titleh1{color:#0f0}"}`; `<p>cap<img src="hero.png"></p>`, `<h1>t<svg>…</svg></h1>` and `<span>n=<rm-counter from="0" to="100"></rm-counter></span>` drop the img/svg/counter entirely and exit 0. This is a live regression of "constat 1" and "constat 3", which tests/silent_loss_regressions.rs asserts are fixed — the fix only ever covered the `Container` path.
Refs #220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Severity Medium, category correctness. Location:
crates/rustmotion-html/src/element.rs:95Impact
The
TagKind::Textarm never callselement_to_valueon its children, so the whole guard layer (StyleElementUnsupported,UnsupportedNativeElement,TagKind::Ignored) is unreachable belowp/span/h1..h6/strong/em/label. Executed against the real crate:<p>Real <script>var secret = 1; alert(2);</script></p>transpiles to{"content":"Real var secret = 1; alert(2);","type":"text"}— the JS source is rendered on screen;<h1>Title<style>h1{color:#0f0}</style></h1>gives{"content":"Titleh1{color:#0f0}"};<p>cap<img src="hero.png"></p>,<h1>t<svg>…</svg></h1>and<span>n=<rm-counter from="0" to="100"></rm-counter></span>drop the img/svg/counter entirely and exit 0. This is a live regression of "constat 1" and "constat 3", which tests/silent_loss_regressions.rs asserts are fixed — the fix only ever covered theContainerpath.Fix
Make the Text arm walk children through
element_to_value(or at minimum run a pre-pass over the subtree that raisesStyleElementUnsupported/UnsupportedNativeElement/ refuses any non-Text element child) instead of flattening withinner_text.inner_textshould also skipTagKind::Ignoredandstylesubtrees. Add the nested variants of the existing regression tests:<p><script>,<h1><style>,<p><img>,<span><rm-counter>.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-11).