Bug 60066 - [chromium] Go through WebPermissionClient for local storage access. Also cleanup left over code from previous WebPermissionClient change.
Summary: [chromium] Go through WebPermissionClient for local storage access. Also cle...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: John Abd-El-Malek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 14:44 PDT by John Abd-El-Malek
Modified: 2011-05-03 19:09 PDT (History)
3 users (show)

See Also:


Attachments
Patch (8.63 KB, patch)
2011-05-03 14:49 PDT, John Abd-El-Malek
no flags Details | Formatted Diff | Diff
Patch (9.58 KB, patch)
2011-05-03 18:04 PDT, John Abd-El-Malek
no flags Details | Formatted Diff | Diff
Patch (9.39 KB, patch)
2011-05-03 18:52 PDT, John Abd-El-Malek
no flags Details | Formatted Diff | Diff
Patch (9.39 KB, patch)
2011-05-03 19:03 PDT, John Abd-El-Malek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Abd-El-Malek 2011-05-03 14:44:49 PDT
[chromium] Go through WebPermissionClient for local storage access.  Also cleanup left over code from previous WebPermissionClient change.
Comment 1 John Abd-El-Malek 2011-05-03 14:49:37 PDT
Created attachment 92137 [details]
Patch
Comment 2 John Abd-El-Malek 2011-05-03 14:53:06 PDT
ccing Darin since it's WebKit API, although I don't think we need to wait for his ok for this since it's just adding a similar function to an API he just reviewed.
Comment 3 John Abd-El-Malek 2011-05-03 14:54:09 PDT
chrome side change: http://codereview.chromium.org/6915017/
Comment 4 James Robinson 2011-05-03 15:07:03 PDT
Comment on attachment 92137 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=92137&action=review

> Source/WebKit/chromium/public/WebPermissionClient.h:49
> +    virtual bool allowLocalStorage(WebFrame*, const WebURL&) { return true; }

the URL can be generated from the WebFrame, so it's redundant here

> Source/WebKit/chromium/src/StorageAreaProxy.cpp:89
> +    if (webView->permissionClient()
> +        && !webView->permissionClient()->allowLocalStorage(webFrame, url)) {

nit: don't line wrap this
Comment 5 James Robinson 2011-05-03 16:20:46 PDT
Comment on attachment 92137 [details]
Patch

According to Dr Barth the allowLocalStorage() implementation should be using securityOrigin() and not URL.  There are case where the two can differ and we definitely don't want to let a page get around the user's local storage settings by faking out the url.
Comment 6 John Abd-El-Malek 2011-05-03 16:28:43 PDT
(In reply to comment #5)
> (From update of attachment 92137 [details])
> According to Dr Barth the allowLocalStorage() implementation should be using securityOrigin() and not URL.  There are case where the two can differ and we definitely don't want to let a page get around the user's local storage settings by faking out the url.


So the old code was calling frame->document()->url(), hence why I moved it to do the same.  Does securityOrigin() return the whole url, or only scheme+host+port?  If it's the latter, then that wouldn't work if the user has a content setting for a url that has path for example.
Comment 7 John Abd-El-Malek 2011-05-03 18:04:33 PDT
Created attachment 92179 [details]
Patch
Comment 8 Adam Barth 2011-05-03 18:12:35 PDT
> So the old code was calling frame->document()->url(), hence why I moved it to do the same.  Does securityOrigin() return the whole url, or only scheme+host+port?  If it's the latter, then that wouldn't work if the user has a content setting for a url that has path for example.

Security restrictions at a finer granularity than a scheme+host+port don't work.
Comment 9 John Abd-El-Malek 2011-05-03 18:33:57 PDT
ok so I tried to set content settings policies for a url with a path, and that didn't work.  so it looks like it's just for hostnames then, in which case using securityOrigin should be fine.  however, that should be done in a separate cl, in case that has any side-effects.  this change has others that depend on it, and once they're committed, reverting this won't be possible without reverting the chorme side.
Comment 10 James Robinson 2011-05-03 18:43:28 PDT
Comment on attachment 92179 [details]
Patch

R=me. I agree that changing the url/securityOrigin behavior should be a separate patch.
Comment 11 John Abd-El-Malek 2011-05-03 18:52:36 PDT
Created attachment 92182 [details]
Patch
Comment 12 John Abd-El-Malek 2011-05-03 18:53:39 PDT
I filed bug 60108 for the url issue.

i updated the patch to include the chromium revision with the chrome side change.
Comment 13 John Abd-El-Malek 2011-05-03 19:03:35 PDT
Created attachment 92184 [details]
Patch
Comment 14 John Abd-El-Malek 2011-05-03 19:09:09 PDT
Committed r85703: <http://trac.webkit.org/changeset/85703>