Skip to content

bug(composition): style values admit raw-text breakouts and CSS escape bypasses #448

Open

Description

@Wenjix

Security review findings (medium CWE-79 + low CWE-918).

assertVisualStyleV1 in packages/composition/src/visual.ts blocks literal url(/image-set(/var(/env(/attr( and declaration separators but allows < and \:

  • Animation keyframe values are emitted verbatim into a raw-text <style> element (packages/html-program/src/document.ts), so red</style><script>… terminates it and injects markup into the render document.
  • Browsers resolve CSS backslash escapes before recognizing functions, so u\72 l(https://evil/) passes the literal url( check and decodes to a resource fetch — an SSRF bypass of the typed-Artifact policy.

Proposed fix: reject < and \ in style values — parity with assertColor, which already rejects both.

Fix: #440

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions