Repository navigation
Conversation
…values Style declarations are serialized into a raw-text <style> element and inline style attributes. Two gaps let authored values break the typed-Artifact resource policy: - `<` terminates the <style> element at compile time, letting a keyframe or element style introduce executable markup into the render document. - A backslash opens a CSS escape, so `u\72 l(...)` reaches the browser as `url(...)` while evading the literal `url(`/`image-set(` checks. Reject both characters as unsafe style values. Legitimate V1 values (transforms, colors, gradients, filters) never require them. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This branch has not been deployed
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.
Closes #448
Summary
Two classes of escape reaching the HTML
<style>block and CSS resource functions throughassertVisualStyleV1inpackages/composition/src/visual.ts:<style>element bypackages/html-program/src/document.ts. The validator blocked;,{}and control characters but not<, so a value likered</style><script>alert(1)</script>terminates the element and injects markup into the render document.url(/image-set(/var(/env(/attr(checks are literal substring/regex checks, but CSS resolves backslash escapes before recognizing functions —u\72 l(https://evil/),linear-gradient(red\2c url(evil))pass the literal checks and decode to resource-bearing or syntax-altering CSS in the browser, smuggling a fetch past the typed-Artifact policy.<and\outright. Neither character is needed by any property in the supported style set, andassertColor(the sibling validator for paint values) already rejected both — this brings style values to parity.Behavior relative to main
transform: translateX(4px)color: red</style><script>…<style>background: u\72 l(https://evil/)</style>Red / green
packages/composition/test/track.test.ts: three new cases — a</style><script>value, au\72 l()escaped-URL value, and an animation keyframe carrying the terminator — each fails on main (value admitted) and throws here.Verification
node --import tsx --test packages/composition/test/track.test.ts— 13 pass.pnpm check— clean.Merge Danger
<or\are now rejected. Both were already unsafe; no legitimate CSS in the supported set needs them.Checklist
Generated with Devin