WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238158
Check if origin can access storage in Storage API
https://bugs.webkit.org/show_bug.cgi?id=238158
Summary
Check if origin can access storage in Storage API
Sihui Liu
Reported
2022-03-21 15:41:48 PDT
https://storage.spec.whatwg.org/#storage-keys
Attachments
Patch
(6.38 KB, patch)
2022-03-21 15:44 PDT
,
Sihui Liu
no flags
Details
Formatted Diff
Diff
Patch
(6.37 KB, patch)
2022-03-21 15:47 PDT
,
Sihui Liu
no flags
Details
Formatted Diff
Diff
Patch for landing
(6.76 KB, patch)
2022-03-22 14:40 PDT
,
Sihui Liu
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Sihui Liu
Comment 1
2022-03-21 15:44:26 PDT
Created
attachment 455287
[details]
Patch
Sihui Liu
Comment 2
2022-03-21 15:47:07 PDT
Created
attachment 455288
[details]
Patch
Chris Dumez
Comment 3
2022-03-21 19:54:22 PDT
Comment on
attachment 455288
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455288&action=review
> Source/WebCore/Modules/storage/StorageManager.cpp:73 > + if (!origin->canAccessStorage())
The spec merely says to check if the origin is opaque (which we call unique in WebKit). Why not simply check `origin->isUnique()` ?
> Source/WebCore/page/SecurityOrigin.h:154 > + bool canAccessStorage() const { return canAccessStorage(nullptr); }
There is a comment inside canAccessStorage() saying that we should stop passing nullptr so this may not be a change in the right direction.
Sihui Liu
Comment 4
2022-03-22 09:45:00 PDT
(In reply to Chris Dumez from
comment #3
)
> Comment on
attachment 455288
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=455288&action=review
> > > Source/WebCore/Modules/storage/StorageManager.cpp:73 > > + if (!origin->canAccessStorage()) > > The spec merely says to check if the origin is opaque (which we call unique > in WebKit). Why not simply check `origin->isUnique()` ?
I see the other APIs using canAccessStorage to check so I use it for consistency. I guess we can only check if origin is unique, though I don't know why we can ignore storage blocking policy for Storage API.
> > > Source/WebCore/page/SecurityOrigin.h:154 > > + bool canAccessStorage() const { return canAccessStorage(nullptr); } > > There is a comment inside canAccessStorage() saying that we should stop > passing nullptr so this may not be a change in the right direction.
Chris Dumez
Comment 5
2022-03-22 09:54:43 PDT
Comment on
attachment 455288
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455288&action=review
>>> Source/WebCore/Modules/storage/StorageManager.cpp:73 >>> + if (!origin->canAccessStorage()) >> >> The spec merely says to check if the origin is opaque (which we call unique in WebKit). Why not simply check `origin->isUnique()` ? > > I see the other APIs using canAccessStorage to check so I use it for consistency. > I guess we can only check if origin is unique, though I don't know why we can ignore storage blocking policy for Storage API.
Ok, so you want to do more checks that simply opaque origin, is that right? The change log doesn't say anything about that (and neither does the spec). The change may well be correct if so.
Sihui Liu
Comment 6
2022-03-22 10:23:05 PDT
(In reply to Chris Dumez from
comment #5
)
> Comment on
attachment 455288
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=455288&action=review
> > >>> Source/WebCore/Modules/storage/StorageManager.cpp:73 > >>> + if (!origin->canAccessStorage()) > >> > >> The spec merely says to check if the origin is opaque (which we call unique in WebKit). Why not simply check `origin->isUnique()` ? > > > > I see the other APIs using canAccessStorage to check so I use it for consistency. > > I guess we can only check if origin is unique, though I don't know why we can ignore storage blocking policy for Storage API. > > Ok, so you want to do more checks that simply opaque origin, is that right? > The change log doesn't say anything about that (and neither does the spec). > > The change may well be correct if so.
Yes, I would like to make this consistent with IndexedDB, whose spec only says about opaque origin(
https://www.w3.org/TR/IndexedDB/#dom-idbfactory-open
), but we also check storage blocking policy of the origin (we don't check its top origin, so we pass nullptr). I will update changelog to include this.
Chris Dumez
Comment 7
2022-03-22 10:23:38 PDT
Comment on
attachment 455288
[details]
Patch Ok.
Sihui Liu
Comment 8
2022-03-22 14:40:09 PDT
Created
attachment 455429
[details]
Patch for landing
EWS
Comment 9
2022-03-22 16:54:30 PDT
Committed
r291726
(
248758@main
): <
https://commits.webkit.org/248758@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 455429
[details]
.
Radar WebKit Bug Importer
Comment 10
2022-03-22 16:55:15 PDT
<
rdar://problem/90667430
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug