-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partition Blob URL revocation by Storage Key #201
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1512,15 +1512,25 @@ A [=blob URL store=] is a [=map=] | |
where [=map/keys=] are [=valid URL strings=] | ||
and [=map/values=] are [=blob URL Entries=]. | ||
|
||
A <dfn export>blob URL entry</dfn> consists of | ||
an <dfn export for="blob URL entry">object</dfn> (of type {{Blob}} or {{MediaSource}}), | ||
and an <dfn export for="blob URL entry">environment</dfn> (an [=environment settings object=]). | ||
|
||
[=map/Keys=] in the [=blob URL store=] (also known as <dfn lt="blob URL|object URL" export>blob URLs</dfn>) | ||
are [=valid URL strings=] that when [=URL parser|parsed=] | ||
result in a [=/URL=] with a [=url/scheme=] equal to "`blob`", | ||
an [=empty host=], and a [=url/path=] consisting of one element itself also a [=valid URL string=]. | ||
|
||
A <dfn export>blob URL entry</dfn> is used to store an object of type {{Blob}} or {{MediaSource}}. | ||
|
||
A [=blob URL entry=] has an <dfn export for="blob URL entry">environment</dfn> (an [=environment settings object=]). | ||
|
||
<div algorithm="obtainBlobObject"> | ||
To <dfn export id=blob-url-obtain-object>obtain a blob object</dfn> given a [=blob URL entry=] |blobUrlEntry|, an [=environment=] |environment|, and an optional boolean |isNavigation| (default false): | ||
|
||
1. Let |isAuthorized| be true. | ||
1. If |isNavigation| is false, let |isAuthorized| be the result of [=checking for same-partition blob URL usage=] with |blobUrlEntry| and |environment|. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you manipulate an initialized variable, you need to use "set ... to". See the Infra standard for more complete guidance. |
||
1. If |isAuthorized| is false, then return failure. | ||
1. Return |blobUrlEntry|'s object. | ||
|
||
</div> | ||
|
||
<div algorithm="createBlobURL"> | ||
To <dfn id="unicodeBlobURL" lt="generate a new blob URL|generating a new blob URL"> | ||
generate a new blob URL</dfn>, run the following steps: | ||
|
@@ -1595,6 +1605,22 @@ as the serialization of the origin of the environment that created the blob URL, | |
but for opaque origins the origin itself might be distinct. This difference isn't | ||
observable though, since a revoked blob URL can't be resolved/fetched anymore anyway. | ||
|
||
### Access restrictions on blob URLs ### {#partitioningOfBlobUrls} | ||
|
||
<a>Blob URLs</a> can only be fetched from environments where the [=storage key=] matches that of | ||
the environment where the <a>blob URL</a> was created. <a>blob URL</a> navigations are not subject | ||
to this restriction. | ||
|
||
<div algorithm="checkForSamePartitionBlobUrlUsage"> | ||
To <dfn export id=blob-url-partition-check>check for same-partition blob URL usage</dfn> given a [=blob URL entry=] |blobUrlEntry| and an [=environment=] |environment|: | ||
|
||
1. Let |blobStorageKey| be the result of [=obtaining a storage key for non-storage purposes=] with |blobUrlEntry|'s [=blob URL entry/environment=]. | ||
1. Let |environmentStorageKey| be the result of [=obtaining a storage key for non-storage purposes=] with |environment|. | ||
1. If |blobStorageKey| is not [=storage key/equal=] to |environmentStorageKey|, then return false. | ||
1. Otherwise, return true. | ||
|
||
</div> | ||
|
||
<h4 id="lifeTime" dfn for="blob url" lt="lifetime|lifetime stipulation" export>Lifetime of blob URLs</h4> | ||
|
||
This specification extends the [=unloading document cleanup steps=] with the following steps: | ||
|
@@ -1632,12 +1658,13 @@ The <dfn method for=URL id="dfn-revokeObjectURL">revokeObjectURL(|url|)</dfn> st | |
|
||
1. Let |url record| be the result of [=URL parser|parsing=] |url|. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe change this to urlRecord while here? Having these as separate words is confusing with the url variable. |
||
1. If |url record|'s [=url/scheme=] is not "`blob`", return. | ||
1. Let |origin| be the [=url/origin=] of |url record|. | ||
1. Let |settings| be the [=current settings object=]. | ||
1. If |origin| is not [=same origin=] with |settings|'s [=environment settings object/origin=], return. | ||
1. Let |entry| be |url record|'s [=blob URL entry=]. | ||
1. If |entry| is null, return. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then return* |
||
1. Let |isAuthorized| be the result of [=checking for same-partition blob URL usage=] with |entry| and the [=current settings object=]. | ||
1. If |isAuthorized| is false, return. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then return* |
||
1. [=Remove an entry from the Blob URL Store=] for |url|. | ||
|
||
Note: This means that rather than throwing some kind of error, attempting to revoke a URL that isn't registered will silently fail. | ||
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. | ||
User agents might display a message on the error console if this happens. | ||
|
||
Note: Attempts to dereference |url| after it has been revoked will result in a [=network error=]. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this. I would continue to give a blob URL entry an object field, but just no longer export it. And then explain in a note that specifications have to use "obtain a blob object" to get hold of the object.