Skip to content

Commit 483d3f2

Browse files
authored
[css-values] Total attr()-tainting for substitution values (#11218)
This may have been the intended meaning of the spec text already, but I think we should clearly state the outcome of #5092: partial tainting of custom properties was proposed in that issue, discussed, objected to, and therefore *not* accepted. This PR hopefully makes it clear that attr()-tainting applies to whole substitution values, for now.
1 parent e971c65 commit 483d3f2

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

css-values-5/Overview.bs

+17-5
Original file line numberDiff line numberDiff line change
@@ -1743,16 +1743,20 @@ Security</h4>
17431743
To guard against this,
17441744
the values produced by an ''attr()'' are considered <dfn export lt="attr()-taint">attr()-tainted</dfn>,
17451745
as are functions that contain an [=attr()-tainted=] value.
1746-
[=Registered custom properties=] containing ''attr()''
1747-
maintain the [=attr()-taint=] on their [=attr()-tainted=] values
1748-
across [=var() substitution=].
1746+
1747+
The substitution value of an [=arbitrary substitution function=]
1748+
is [=attr()-tainted=] <em>as a whole</em>
1749+
if any [=attr()-tainted=] values were involved
1750+
in creating that substitution value.
1751+
<span class=note>This extends to the [=equivalent token sequence=]
1752+
when substituting values of [=registered custom properties=].</span>
17491753

17501754
Using an [=attr()-tainted=] value as or in a <<url>>
17511755
makes a declaration [=invalid at computed-value time=].
17521756

17531757
<div class=example>
17541758
For example,
1755-
all of the following are invalid:
1759+
all of the following are [=invalid at computed-value time=]:
17561760

17571761
* ''background-image: src(attr(foo));'' - can't use it directly.
17581762
* ''background-image: image(attr(foo))'' - can't use it in other <<url>>-taking functions.
@@ -1765,6 +1769,14 @@ Security</h4>
17651769
* ''background-image: image("foo.jpg", attr(bgcolor type(&lt;color>)))'' is fine;
17661770
the ''attr()'' is providing a fallback color,
17671771
and the <<url>> isn't [=attr()-tainted=].
1772+
1773+
Using ''attr()'' indirectly via a [=custom property=]
1774+
causes [=attr()-tainting=] of the whole custom property value:
1775+
1776+
* ''--foo: image("foo.jpg", attr(bgcolor type(&lt;color&gt;))); background-image: var(--foo);''
1777+
is [=invalid at computed-value time=].
1778+
1779+
Issue: Investigate partial tainting of custom property values.
17681780
</div>
17691781

17701782
Note: Implementing this restriction
@@ -1776,7 +1788,7 @@ Security</h4>
17761788
Note that non-string types can even trigger this,
17771789
via functions like <css>string()</css>
17781790
that can stringify other types of values:
1779-
''--foo: attr(foo type(<number>)); background-image: src(string(var(--foo)))''
1791+
''--foo: attr(foo type(&lt;number&gt;)); background-image: src(string(var(--foo)))''
17801792
needs to be invalid as well.
17811793

17821794
<!-- Big Text: random

0 commit comments

Comments
 (0)