Skip to content

Commit 77b2086

Browse files
authored
Partition Blob URL revocation by Storage Key (#201)
Adds new "obtain a blob object" algorithm that does partition checks, and use that in the blob url revocation steps.
1 parent 851e00e commit 77b2086

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

index.bs

+41-9
Original file line numberDiff line numberDiff line change
@@ -1512,15 +1512,30 @@ A [=blob URL store=] is a [=map=]
15121512
where [=map/keys=] are [=valid URL strings=]
15131513
and [=map/values=] are [=blob URL Entries=].
15141514

1515-
A <dfn export>blob URL entry</dfn> consists of
1516-
an <dfn export for="blob URL entry">object</dfn> (of type {{Blob}} or {{MediaSource}}),
1517-
and an <dfn export for="blob URL entry">environment</dfn> (an [=environment settings object=]).
1515+
A <dfn export>blob URL entry</dfn> consists of an <dfn for="blob URL entry">object</dfn> (of type
1516+
{{Blob}} or {{MediaSource}}), and an <dfn export for="blob URL entry">environment</dfn> (an
1517+
[=environment settings object=]).
1518+
1519+
Note: Specifications have to use the [=obtain a blob object=] algorithm to access a
1520+
[=blob URL entry=]'s [=blob URL entry/object=].
15181521

15191522
[=map/Keys=] in the [=blob URL store=] (also known as <dfn lt="blob URL|object URL" export>blob URLs</dfn>)
15201523
are [=valid URL strings=] that when [=URL parser|parsed=]
15211524
result in a [=/URL=] with a [=url/scheme=] equal to "`blob`",
15221525
an [=empty host=], and a [=url/path=] consisting of one element itself also a [=valid URL string=].
15231526

1527+
<div algorithm="obtainBlobObject">
1528+
To <dfn export id=blob-url-obtain-object>obtain a blob object</dfn> given a [=blob URL entry=]
1529+
|blobUrlEntry| and an [=environment settings object=] or the string "`navigation`" |environment|,
1530+
perform the following steps. They return an [=blob URL entry/object=].
1531+
1532+
1. Let |isAuthorized| be true.
1533+
1. If |environment| is not the string "`navigation`", then set |isAuthorized| to the result of [=checking for same-partition blob URL usage=] with |blobUrlEntry| and |environment|.
1534+
1. If |isAuthorized| is false, then return failure.
1535+
1. Return |blobUrlEntry|'s [=blob URL entry/object=].
1536+
1537+
</div>
1538+
15241539
<div algorithm="createBlobURL">
15251540
To <dfn id="unicodeBlobURL" lt="generate a new blob URL|generating a new blob URL">
15261541
generate a new blob URL</dfn>, run the following steps:
@@ -1595,6 +1610,22 @@ as the serialization of the origin of the environment that created the blob URL,
15951610
but for opaque origins the origin itself might be distinct. This difference isn't
15961611
observable though, since a revoked blob URL can't be resolved/fetched anymore anyway.
15971612

1613+
### Access restrictions on blob URLs ### {#partitioningOfBlobUrls}
1614+
1615+
<a>Blob URLs</a> can only be fetched from environments where the [=storage key=] matches that of
1616+
the environment where the <a>blob URL</a> was created. <a>Blob URL</a> navigations are not subject
1617+
to this restriction.
1618+
1619+
<div algorithm="checkForSamePartitionBlobUrlUsage">
1620+
To <dfn>check for same-partition blob URL usage</dfn> given a [=blob URL entry=] |blobUrlEntry| and an [=environment settings object=] |environment|, perform the following steps. They return a boolean.
1621+
1622+
1. Let |blobStorageKey| be the result of [=obtaining a storage key for non-storage purposes=] with |blobUrlEntry|'s [=blob URL entry/environment=].
1623+
1. Let |environmentStorageKey| be the result of [=obtaining a storage key for non-storage purposes=] with |environment|.
1624+
1. If |blobStorageKey| is not [=storage key/equal=] to |environmentStorageKey|, then return false.
1625+
1. Return true.
1626+
1627+
</div>
1628+
15981629
<h4 id="lifeTime" dfn for="blob url" lt="lifetime|lifetime stipulation" export>Lifetime of blob URLs</h4>
15991630

16001631
This specification extends the [=unloading document cleanup steps=] with the following steps:
@@ -1630,14 +1661,15 @@ return the result of [=adding an entry to the blob URL store=] for |obj|.
16301661
<div algorithm="revokeObjectURL">
16311662
The <dfn method for=URL id="dfn-revokeObjectURL">revokeObjectURL(|url|)</dfn> static method must run these steps:
16321663

1633-
1. Let |url record| be the result of [=URL parser|parsing=] |url|.
1634-
1. If |url record|'s [=url/scheme=] is not "`blob`", return.
1635-
1. Let |origin| be the [=url/origin=] of |url record|.
1636-
1. Let |settings| be the [=current settings object=].
1637-
1. If |origin| is not [=same origin=] with |settings|'s [=environment settings object/origin=], return.
1664+
1. Let |urlRecord| be the result of [=URL parser|parsing=] |url|.
1665+
1. If |urlRecord|'s [=url/scheme=] is not "`blob`", return.
1666+
1. Let |entry| be |urlRecord|'s [=blob URL entry=].
1667+
1. If |entry| is null, then return.
1668+
1. Let |isAuthorized| be the result of [=checking for same-partition blob URL usage=] with |entry| and the [=current settings object=].
1669+
1. If |isAuthorized| is false, then return.
16381670
1. [=Remove an entry from the Blob URL Store=] for |url|.
16391671

1640-
Note: This means that rather than throwing some kind of error, attempting to revoke a URL that isn't registered will silently fail.
1672+
Note: This means that rather than throwing some kind of error, attempting to revoke a URL that isn't registered or that was registered from an environment in a different storage partition will silently fail.
16411673
User agents might display a message on the error console if this happens.
16421674

16431675
Note: Attempts to dereference |url| after it has been revoked will result in a [=network error=].

0 commit comments

Comments
 (0)