Skip to content

[css-shapes] Consider ways to make the CORS limitation in CSS Shapes easier for authors  #1481

@jensimmons

Description

@jensimmons

User agents must use the potentially CORS-enabled fetch method defined by the [HTML5] specification for all URLs in a shape-outside value. When fetching, user agents must use "Anonymous" mode, set the referrer source to the stylesheet’s URL and set the origin to the URL of the containing document. If this results in network errors such that there is no valid fallback image, the effect is as if the value none had been specified.
https://drafts.csswg.org/css-shapes/#shape-outside-property

When using a image file to define a shape, shape-outside: url(foo.png);, the specification requires browsers to restrict this feature so that it only works with CORS-enabled files.

I can tell you from experience — my own, and the people I talk to who are attempting to use Shapes — this causes problems. It's likely that shape-outside:url() will not work, even when working locally with a very simple setup. In fact, it seems to fail most of the time. Trying to teach people Shapes while expecting them to know how to dig into SysAdmin level debugging is terrible.

I do not understand why this limitation was put into place. I can see how people might wish to get into a time-machine and restrict all uses of images on the web to such a security standard, but that would in fact require a time machine. Putting this restriction on one part of CSS while not having it on any other doesn't seem to do anything to increase the security of the web. If I want to attack a website, and can find a way to do with a reference to an image file in CSS — I could just use background instead of shape-outside.

This seems to me to be a case where theoretical purity was put before authors, in violation of the Priority of Constituencies. I think we should reconsider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions