Bug 34778

Summary: Add support to isolate file:/// URIs in their own domain by default
Product: WebKit Reporter: Chris Evans <scarybeasts>
Component: PlatformAssignee: Chris Evans <scarybeasts>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, eric, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Add support for putting file:/// URIs into their own unique domain
none
Updated so new methods are at bottom of IDL file
sam: review+, commit-queue: commit-queue-
Trivial merge with Changeset 54587. Ready to go to commit queue again.
eric: review+, commit-queue: commit-queue-
Export new WebCore function to fix Mac link error none

Description Chris Evans 2010-02-09 17:28:37 PST
Chromium will use this new mode by default. Patch forthcoming...
Comment 1 Chris Evans 2010-02-09 17:42:18 PST
Created attachment 48454 [details]
Add support for putting file:/// URIs into their own unique domain
Comment 2 Chris Evans 2010-02-09 17:43:16 PST
Adam, can you help me land this? It's mostly trivial / tedious wiring. I think I got all the places.
Once landed I can get on with the subsequent changes (Chromium wiring and then add the test, which I promise I won't neglect to do :)
Comment 3 Adam Barth 2010-02-09 18:05:51 PST
Kind of ridiculous what it takes to add one bit of state, huh?

One minor issue, you need to add new functions at the bottom of the IDL file because of the way virtual functions work in C++.  Other than that, looks reasonable.

I'm leaving this r? for now in case other folks want to discuss what we're thinking about doing here.  We've had some discussion on #webkit in the past, but Chris and my thinking has evolved slightly since then.
Comment 4 Chris Evans 2010-02-09 20:23:56 PST
Assuming your IDL comment refers to IWebPreferencesPrivate.idl -- new patch forthcoming.

NOTE - this patch doesn't change the WebKit default behaviour at all. That's left for clients to do if they want additional security for file:/// URIs.

Given that this won't affect WebKit clients, but Chromium wants to use this -- I'm in favour of submitting sooner rather than later :)
Comment 5 Chris Evans 2010-02-09 20:24:53 PST
Created attachment 48459 [details]
Updated so new methods are at bottom of IDL file
Comment 6 Sam Weinig 2010-02-09 22:47:19 PST
Can you explain what issues you are trying to mitigate with this new mode? You say your thinking in this area has changed, what changed your mind?
Comment 7 Adam Barth 2010-02-09 22:55:53 PST
> Can you explain what issues you are trying to mitigate with this new mode?

The risk is that a user might download an HTML document in an email.  When they viewed that document, the document would be able to steal any file on the their hard drive.

> You say your thinking in this area has changed, what changed your mind?

A couple things:

1) Chris noticed that he was doing the above a bunch and got scared.
2) He wants to try turning this on in a Chrome Dev channel release (the equivalent of the WebKit nightly builds) to see how the community reacts.

My guess is that we'll get a bunch of complaints and will need to back off, but I'm not sure where we'll end up.  When we discussed this on #webkit, Maciej suggested some kind of "Developer mode" that would have more permissive file:// URL restrictions.

This is all very much open for discussion, but having code seemed like a good way to start the discussion.
Comment 8 Chris Evans 2010-02-10 00:45:59 PST
Regarding 1), the threat I'm worried about is HTML attachments (e.g. repro.html) on bugs in the WebKit and Chromium bug databases. I could feasibly get my files stolen. Not good. I'd rather the browser protected me by default.

Regarding 2), I really don't expect much kick back. I have added a Chromium command-line flag override for developers that need communication between local files. 99% of our users likely won't notice or care, and could use the extra protection.
Well, there's only one way to find out. If we can get this WebKit patch landed, I'll flip the setting in the next Chromium dev channel build and report back.
Comment 9 Sam Weinig 2010-02-10 10:36:11 PST
Thanks for the explanation.
Comment 10 Sam Weinig 2010-02-10 10:37:38 PST
Comment on attachment 48459 [details]
Updated so new methods are at bottom of IDL file

Please follow this up with a test case.
Comment 11 Chris Evans 2010-02-10 11:47:56 PST
Yep, test is pending. I need to get this landed, then the Chromium changes landed, before I can land the test without breaking anything. Joy of dependencies :)
Comment 12 WebKit Commit Bot 2010-02-10 18:26:26 PST
Comment on attachment 48459 [details]
Updated so new methods are at bottom of IDL file

Rejecting patch 48459 from commit-queue.

Failed to run "['/Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/svn-apply', '--reviewer', 'Sam Weinig', '--force']" exit_code: 1
Last 500 characters of output:
e WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
Hunk #1 succeeded at 329 (offset 5 lines).
patching file WebKitTools/DumpRenderTree/LayoutTestController.cpp
Hunk #1 succeeded at 928 (offset 19 lines).
Hunk #2 succeeded at 1380 (offset 20 lines).
patching file WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
patching file WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
patching file WebKitTools/DumpRenderTree/LayoutTestController.h
Hunk #1 succeeded at 69 (offset 1 line).

Full output: http://webkit-commit-queue.appspot.com/results/256695
Comment 13 Chris Evans 2010-02-10 19:56:36 PST
Grr! Clashes with Changeset 54587 for trunk/WebCore/page/SecurityOrigin.cpp by Mr. Barth :)
Updating patch in progress....
Comment 14 Chris Evans 2010-02-10 20:24:25 PST
Created attachment 48544 [details]
Trivial merge with Changeset 54587. Ready to go to commit queue again.
Comment 15 Chris Evans 2010-02-10 20:25:40 PST
Adam, Sam or Eric: can you r+, cq? the updated patch? The trivial conflict with SecurityOrigin.cpp has been resolved.
Comment 16 Eric Seidel (no email) 2010-02-11 03:22:49 PST
Comment on attachment 48544 [details]
Trivial merge with Changeset 54587. Ready to go to commit queue again.

The commit-queue spun on this one for a while, making me think there might be something wrong with the patch.

I'm going to re-mark this r? so that the EWS bots run on it.  If those pass, i'm happy to mark it cq+
Comment 17 Chris Evans 2010-02-11 11:12:53 PST
I'm no expert, but I see green on EWS? :)
Comment 18 Eric Seidel (no email) 2010-02-11 11:22:33 PST
Comment on attachment 48544 [details]
Trivial merge with Changeset 54587. Ready to go to commit queue again.

Yup.  lets do this thang.
Comment 19 WebKit Commit Bot 2010-02-11 22:37:44 PST
Comment on attachment 48544 [details]
Trivial merge with Changeset 54587. Ready to go to commit queue again.

Rejecting patch 48544 from commit-queue.

Unexpected failure when landing patch!  Please file a bug against webkit-patch.
Failed to run "['WebKitTools/Scripts/webkit-patch', '--status-host=webkit-commit-queue.appspot.com', 'land-attachment', '--force-clean', '--non-interactive', '--no-update', '--parent-command=commit-queue', '--build-style=both', '--quiet', '48544']" exit_code: 1
Last 500 characters of output:
ebkitpy/statusserver.py", line 87, in update_status
    return NetworkTransaction().run(lambda: self._post_to_server(queue_name, status, patch, results_file))
  File "/Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/webkitpy/networktransaction.py", line 52, in run
    self._check_for_timeout()
  File "/Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/webkitpy/networktransaction.py", line 58, in _check_for_timeout
    raise NetworkTimeout()
webkitpy.networktransaction.NetworkTimeout
Comment 20 Chris Evans 2010-02-12 11:46:05 PST
Argh! The latest reject has no "full output" link, so I can't see what might have gone wrong. Looks like a timeout waiting for the network?
Can anyone help me land this?
Comment 21 Eric Seidel (no email) 2010-02-12 11:48:06 PST
Yeah, that's what happened last time.  The commit-queue hung for hours trying to post the actual output.

I'll attempt to land this manually this afternoon.  Sorry for the runaround.
Comment 22 Chris Evans 2010-02-12 13:50:56 PST
Thanks, Eric. No need to apologize; there's probably something weird about my patch if this has happened twice?? I can't see anything obviously wrong, though.
Comment 23 Eric Seidel (no email) 2010-02-12 14:36:41 PST
The commit-queue failing to upload the results is a commit queue bug.  The actual failure is:

Ld /Users/eseidel/Projects/build/Release/WebKit.framework/Versions/A/WebKit normal i386
    cd /Users/eseidel/Projects/WebKit/WebKit
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    /Developer/usr/bin/g++-4.2 -arch i386 -dynamiclib -L/Users/eseidel/Projects/build/Release -F/Users/eseidel/Projects/build/Release -F/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -F/System/Library/Frameworks/Carbon.framework/Frameworks -F/System/Library/Frameworks/Quartz.framework/Frameworks -F/System/Library/PrivateFrameworks -filelist /Users/eseidel/Projects/build/WebKit.build/Release/WebKit.build/Objects-normal/i386/WebKit.LinkFileList -Wl,--no-demangle -exported_symbols_list mac/WebKit.exp -install_name /Users/eseidel/Projects/build/Release/WebKit.framework/Versions/A/WebKit -mmacosx-version-min=10.5 -Wl,-dead_strip -sub_umbrella WebCore -lWebKitSystemInterfaceLeopard -framework Carbon -framework Cocoa -framework JavaScriptCore -licucore -framework OpenGL -framework QuartzCore -framework Security -framework WebCore -Wl,-single_module -compatibility_version 1 -current_version 533.1 -o /Users/eseidel/Projects/build/Release/WebKit.framework/Versions/A/WebKit
Undefined symbols:
  "__ZN7WebCore8Settings30setAllowFileAccessFromFileURLsEb", referenced from:
      -[WebView(WebPrivate) _preferencesChangedNotification:] in WebView.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Comment 24 Chris Evans 2010-02-12 14:56:39 PST
Thanks!
Sigh. I'll look at this after the long weekend. Maybe I have a typo. I'm on Chromium Linux so parts of this patch are blind :(
Comment 25 Adam Barth 2010-02-12 21:59:48 PST
You just have to add __ZN7WebCore8Settings30setAllowFileAccessFromFileURLsEb to WebCore.base.exp.  Developing WebKit without a Mac is a minefield.  :)
Comment 26 Chris Evans 2010-02-16 22:53:38 PST
Created attachment 48863 [details]
Export new WebCore function to fix Mac link error
Comment 27 Adam Barth 2010-02-16 22:55:12 PST
Comment on attachment 48863 [details]
Export new WebCore function to fix Mac link error

ok, let's give it a spin
Comment 28 WebKit Commit Bot 2010-02-16 23:32:36 PST
Comment on attachment 48863 [details]
Export new WebCore function to fix Mac link error

Clearing flags on attachment: 48863

Committed r54873: <http://trac.webkit.org/changeset/54873>
Comment 29 WebKit Commit Bot 2010-02-16 23:32:43 PST
All reviewed patches have been landed.  Closing bug.