WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
90618
Add folder access policy to allow local access to same folder and child folders
https://bugs.webkit.org/show_bug.cgi?id=90618
Summary
Add folder access policy to allow local access to same folder and child folders
Yong Li
Reported
2012-07-05 10:11:49 PDT
Currently we can turn off allowFileAccessFromFileURLs() to enable security origin checking for file-based html. However it is too strict to be any useful. I have some lacks to polish and post here.
Attachments
A test case
(401 bytes, application/zip)
2012-07-07 08:13 PDT
,
Yong Li
no flags
Details
the patch
(7.88 KB, patch)
2012-07-07 08:41 PDT
,
Yong Li
no flags
Details
Formatted Diff
Diff
again
(8.02 KB, patch)
2012-07-07 08:46 PDT
,
Yong Li
abarth
: review-
Details
Formatted Diff
Diff
Remove the change to canAccess. It is only for request now.
(7.71 KB, patch)
2012-07-13 10:39 PDT
,
Yong Li
abarth
: review-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Yong Li
Comment 1
2012-07-05 10:16:33 PDT
Make it PLATFORM(BLACKBERRY) only thing for now.
Yong Li
Comment 2
2012-07-07 08:13:14 PDT
Created
attachment 151140
[details]
A test case The different behaviors of 3 desktop browsers: 1. Safari always allows file-to-file XHR request... no matter where the target is. 2. Google Chrome doesn't allow file-to-file XHR, even the target file is in same folder or subfolder. 3. FireFox allows XHR to a file in same folder or a subfolder. the objective of this bug is to add a policy, so webkit can be configured to do the same thing as firefox.
Yong Li
Comment 3
2012-07-07 08:41:43 PDT
Created
attachment 151141
[details]
the patch
Yong Li
Comment 4
2012-07-07 08:43:51 PDT
Comment on
attachment 151141
[details]
the patch forgot to put more info to the changelog
Yong Li
Comment 5
2012-07-07 08:46:18 PDT
Created
attachment 151143
[details]
again
Adam Barth
Comment 6
2012-07-07 10:16:55 PDT
Please give me a chance to review this patch before landing. This stuff is very subtle.
Adam Barth
Comment 7
2012-07-07 20:32:18 PDT
Comment on
attachment 151143
[details]
again We shouldn't do this. The web security model doesn't support asymmetric access between frames.
Yong Li
Comment 8
2012-07-09 07:25:12 PDT
(In reply to
comment #7
)
> (From update of
attachment 151143
[details]
) > We shouldn't do this. The web security model doesn't support asymmetric access between frames.
1) This patch doesn't change the behavior of symmetric methods like equal() and isSameSchemeHostPort(). 2) The security model DOES support asymmetric access. 2.1) when a security origin has universal access, it can access those security origins that doesn't have universal access. For example, it can be configured to give file URL universal access and block HTTP URL from accessing file URL. 2.2) Whitelist isn't symmetric. A security origin may be able to access another because the target is in its whitelist. It is asymmetric. Can you think again?
Adam Barth
Comment 9
2012-07-10 08:37:11 PDT
> 1) This patch doesn't change the behavior of symmetric methods like equal() and isSameSchemeHostPort().
Right, but it encourages people to use canAccess in an asymmetric way, which doesn't work the way you'd expect.
> 2) The security model DOES support asymmetric access.
No, it doesn't. If A canAccess B, then B can hack A, which means that the relation isn't actually asymmetric.
> 2.1) when a security origin has universal access, it can access those security origins that doesn't have universal access. For example, it can be configured to give file URL universal access and block HTTP URL from accessing file URL.
Universal access is very insecure and should never be used. I would remove it from WebKit if I could.
> 2.2) Whitelist isn't symmetric. A security origin may be able to access another because the target is in its whitelist. It is asymmetric.
That's different because canRequest deals only with passive objects, like HTTP responses, not active objects like frames.
> Can you think again?
We've had this discussion many times over the years. The current policy isn't great, but it works ok. Folk shouldn't be using file URLs anyway. Their security model is completely broken.
Yong Li
Comment 10
2012-07-10 08:55:49 PDT
(In reply to
comment #9
)
> > 1) This patch doesn't change the behavior of symmetric methods like equal() and isSameSchemeHostPort(). > > Right, but it encourages people to use canAccess in an asymmetric way, which doesn't work the way you'd expect. > > > 2) The security model DOES support asymmetric access. > > No, it doesn't. If A canAccess B, then B can hack A, which means that the relation isn't actually asymmetric. > > > 2.1) when a security origin has universal access, it can access those security origins that doesn't have universal access. For example, it can be configured to give file URL universal access and block HTTP URL from accessing file URL. > > Universal access is very insecure and should never be used. I would remove it from WebKit if I could. > > > 2.2) Whitelist isn't symmetric. A security origin may be able to access another because the target is in its whitelist. It is asymmetric. > > That's different because canRequest deals only with passive objects, like HTTP responses, not active objects like frames.
What if I apply this policy only to canRequest? That will at least solve some issues for sure.
> > We've had this discussion many times over the years. The current policy isn't great, but it works ok. Folk shouldn't be using file URLs anyway. Their security model is completely broken.
This is why I'm adding this policy, to make file URL work better. The policy doesn't affect any port/product as long as it is not turned on. No matter we like or don't like, file URLs is still being widely used. Many of our layout tests is based on file URL.
Yong Li
Comment 11
2012-07-10 12:11:56 PDT
+More Currently WebKit can either be configured to allow file-based pages to access all file system (as Safari does), or block file-to-file access (as Google Chrome does). The former doesn't have any security check, and leaves potential security issues. The latter is too restrict and breaks many offline utilities. Assume that user has downloaded a full set of web pages to local file system, he is supposed to be able to browser the page offline with very little impact. And he shouldn't have to take the risk of having local private data leaked. I really think this new policy will be very helpful.
Yong Li
Comment 12
2012-07-13 10:39:45 PDT
Created
attachment 152297
[details]
Remove the change to canAccess. It is only for request now.
Adam Barth
Comment 13
2012-07-13 10:43:52 PDT
Comment on
attachment 152297
[details]
Remove the change to canAccess. It is only for request now. Still think this is a bad idea. I'm not sure what you're planning to use this for, but I suspect there's a better solution that doesn't involve using file URLs.
Yong Li
Comment 14
2012-07-13 11:06:08 PDT
(In reply to
comment #13
)
> (From update of
attachment 152297
[details]
) > Still think this is a bad idea. I'm not sure what you're planning to use this for, but I suspect there's a better solution that doesn't involve using file URLs.
I'm not using file URLs very often for myself. But there are people that do use file-based html utilities very often, and they work in FireFox and Safari. I cannot ask all of them to run a local http server on their own devices. The problem of Safari solution is it gives universal access to file URL's. Can you consider this as an enhancement of current Safari solution? Adding this policy doesn't force any products to use it. This just gives more options as other policies and settings do.
Adam Barth
Comment 15
2012-07-13 11:15:08 PDT
> I'm not using file URLs very often for myself. But there are people that do use file-based html utilities very often, and they work in FireFox and Safari. I cannot ask all of them to run a local http server on their own devices.
Either that, or you can introduce a new URI scheme that has a sane security model, like the chrome-extension URI scheme.
> The problem of Safari solution is it gives universal access to file URL's. Can you consider this as an enhancement of current Safari solution?
There doesn't seem to be a problem to solve in Safari given that these utilities already work there. We're unlikely to adopt this policy in Chromium, so it's not going to solve your problem there either.
> Adding this policy doesn't force any products to use it. This just gives more options as other policies and settings do.
That's true, but it does make our local security checks even more complicated. I'd much rather make them simpler than more complicated.
Yong Li
Comment 16
2012-07-13 12:00:18 PDT
(In reply to
comment #15
)
> > I'm not using file URLs very often for myself. But there are people that do use file-based html utilities very often, and they work in FireFox and Safari. I cannot ask all of them to run a local http server on their own devices. > > Either that, or you can introduce a new URI scheme that has a sane security model, like the chrome-extension URI scheme.
Can you point me somewhere I can find more information about this solution?
> > > The problem of Safari solution is it gives universal access to file URL's. Can you consider this as an enhancement of current Safari solution? > > There doesn't seem to be a problem to solve in Safari given that these utilities already work there. We're unlikely to adopt this policy in Chromium, so it's not going to solve your problem there either.
These utils already working there doesn't mean there is no problem. There is security concerns. When universal access is given to file URL, file-based html can make request to those files that are outside of its own folder, and then send to remote server.
> > > Adding this policy doesn't force any products to use it. This just gives more options as other policies and settings do. > > That's true, but it does make our local security checks even more complicated. I'd much rather make them simpler than more complicated.
I understand simplicity is good. But we do want to make things work better. The FireFox ways makes sense to me because usually people assume a file-based html package is organized in a folder, and behaves as the folder was the web site.
Adam Barth
Comment 17
2012-07-13 12:43:34 PDT
The Firefox policy is vastly more complicated that just allowing access in one folder. It's so complicated that the Firefox developer who implemented it couldn't explain it to me. He told me how he thought it worked, and I showed him a bunch of cases where it worked differently than he thought. As I wrote above, you should file another solution besides using file URLs. The security model for file URLs is broken beyond repair.
Yong Li
Comment 18
2012-07-16 08:43:58 PDT
(In reply to
comment #17
)
> The Firefox policy is vastly more complicated that just allowing access in one folder. It's so complicated that the Firefox developer who implemented it couldn't explain it to me. He told me how he thought it worked, and I showed him a bunch of cases where it worked differently than he thought. > > As I wrote above, you should file another solution besides using file URLs. The security model for file URLs is broken beyond repair.
Speaking of simplicity, actually I think once the folder policy is done and accepted, we could remove one of these settings or maybe both. void setAllowUniversalAccessFromFileURLs(bool); bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; } void setAllowFileAccessFromFileURLs(bool); bool allowFileAccessFromFileURLs() const { return m_allowFileAccessFromFileURLs; }
Adam Barth
Comment 19
2012-07-16 08:47:24 PDT
> Speaking of simplicity, actually I think once the folder policy is done and accepted, we could remove one of these settings or maybe both.
That's not correct.
> void setAllowUniversalAccessFromFileURLs(bool); > bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; }
This setting is required for Safari and backwards compatibility in the Mac OS X WebView.
> void setAllowFileAccessFromFileURLs(bool); > bool allowFileAccessFromFileURLs() const { return m_allowFileAccessFromFileURLs; }
This setting is required for Chromium. I can't speak for Safari, but I can tell you that Chromium does not want to adopt the "folder" policy.
Yong Li
Comment 20
2012-07-16 08:50:13 PDT
(In reply to
comment #19
)
> > Speaking of simplicity, actually I think once the folder policy is done and accepted, we could remove one of these settings or maybe both. > > That's not correct. > > > void setAllowUniversalAccessFromFileURLs(bool); > > bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; } > > This setting is required for Safari and backwards compatibility in the Mac OS X WebView. > > > void setAllowFileAccessFromFileURLs(bool); > > bool allowFileAccessFromFileURLs() const { return m_allowFileAccessFromFileURLs; } > > This setting is required for Chromium. > > I can't speak for Safari, but I can tell you that Chromium does not want to adopt the "folder" policy.
Even though, setting one policy (or leaving default value) is still simpler than turning off 2 settings per page.
Adam Barth
Comment 21
2012-07-16 08:57:30 PDT
I feel like I'm repeating myself, but Chromium does not want to use the "folder" policy.
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