Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Issue 2364633004: Lock down the registration of blob:chrome-extension:// URLs (Closed)

Created:
4 years, 3 months ago by ncarter (slow)
Modified:
4 years, 2 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, darin-cc_chromium.org, extensions-reviews_chromium.org, loading-reviews_chromium.org, mmenke, Randy Smith (Not in Mondays), site-isolation-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Update ChildProcessSecurityPolicy so that the chrome-extension:// scheme is considered "web safe" to be requestable from any process, but only "web safe" to commit in extension processes. In ChildProcessSecurityPolicy::CanRequestURL and CanCommitURL, when seeing blob and filesystem urls, make a security decision based on the inner origin rather than the scheme. When the extensions ProcessManager (via ExtensionWebContentsObserver) notices a RenderFrame being created in an extension SiteInstance, grant that process permission to commit chrome-extension:// URLs. In BlobDispatcherHost, only allow creation of blob URLs from processes that would be able to commit them. Add a security exploit browsertest that verifies the above mechanisms working together. BUG=644966 Committed: https://crrev.com/a411fd062bc68fc2b5fc3aca7e4cbb8e4a3e074e Committed: https://crrev.com/2a8ba8c4c186e5ea0a2ed938cc5d41441af64228 Cr-Original-Commit-Position: refs/heads/master@{#421964} Cr-Commit-Position: refs/heads/master@{#422474}

Patch Set 1 #

Patch Set 2 : storage DataElement unknown. #

Patch Set 3 : Register kExtensionScheme as WebSafeIsolated #

Patch Set 4 : Stuff. #

Patch Set 5 : Format. #

Patch Set 6 : ' #

Patch Set 7 : Fix extension shell compile. #

Patch Set 8 : Pare down CL #

Total comments: 13

Patch Set 9 : Acquire lock in CanSetAsOriginHeader #

Patch Set 10 : Reviewer fixes. #

Patch Set 11 : ENABLE_EXTENSIONS #

Patch Set 12 : Phrasing. #

Total comments: 18

Patch Set 13 : Reviewer fixes. #

Patch Set 14 : Fix layout test. #

Patch Set 15 : Fix layout test. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+361 lines, -52 lines) Patch
M chrome/browser/DEPS View 1 2 3 4 1 chunk +8 lines, -0 lines 4 comments Download
M chrome/browser/browser_process_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +17 lines, -4 lines 0 comments Download
M chrome/browser/chrome_security_exploit_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +56 lines, -10 lines 0 comments Download
M chrome/browser/devtools/devtools_sanity_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +72 lines, -0 lines 0 comments Download
M chrome/browser/devtools/devtools_ui_bindings.cc View 1 2 3 4 5 6 7 8 3 chunks +11 lines, -0 lines 0 comments Download
M chrome/browser/extensions/process_manager_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +43 lines, -0 lines 0 comments Download
M content/browser/bad_message.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/blob_storage/blob_dispatcher_host.cc View 1 2 3 4 5 6 7 1 chunk +12 lines, -1 line 0 comments Download
M content/browser/child_process_security_policy_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +10 lines, -14 lines 0 comments Download
M content/browser/child_process_security_policy_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +82 lines, -18 lines 0 comments Download
M content/public/browser/child_process_security_policy.h View 1 2 3 4 5 6 7 8 9 2 chunks +37 lines, -2 lines 0 comments Download
M extensions/browser/extension_web_contents_observer.cc View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/xhr-to-blob-in-isolated-world.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -3 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 87 (57 generated)
ncarter (slow)
creis@chromium.org: Please review everything mek@chromium.org: Please review changes in extensions/ thestig@chromium.org: Please review changes in ...
4 years, 2 months ago (2016-09-28 20:35:28 UTC) #30
Lei Zhang
On 2016/09/28 20:35:28, ncarter wrote: > mailto:mek@chromium.org: Please review changes in extensions/ OOO
4 years, 2 months ago (2016-09-28 20:46:51 UTC) #31
ncarter (slow)
-mek +reillyg reillyg: please review extensions/ changes
4 years, 2 months ago (2016-09-28 20:49:27 UTC) #33
Charlie Reis
Looks good, apart from the DevTools extension question and the failing test. https://codereview.chromium.org/2364633004/diff/140001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc ...
4 years, 2 months ago (2016-09-28 22:07:16 UTC) #36
Reilly Grant (use Gerrit)
Adding Devlin because I'm not 100% sure but I think that until we have extension ...
4 years, 2 months ago (2016-09-29 05:00:07 UTC) #38
ncarter (slow)
On 2016/09/29 05:00:07, Reilly Grant wrote: > Adding Devlin because I'm not 100% sure but ...
4 years, 2 months ago (2016-09-29 16:13:02 UTC) #39
ncarter (slow)
https://codereview.chromium.org/2364633004/diff/140001/extensions/shell/browser/shell_browser_main_parts.cc File extensions/shell/browser/shell_browser_main_parts.cc (right): https://codereview.chromium.org/2364633004/diff/140001/extensions/shell/browser/shell_browser_main_parts.cc#newcode137 extensions/shell/browser/shell_browser_main_parts.cc:137: ->RegisterWebSafeIsolatedScheme(extensions::kExtensionResourceScheme); reillyg's comment prompted me to rethink this. If ...
4 years, 2 months ago (2016-09-29 16:27:43 UTC) #40
Devlin
On 2016/09/29 16:13:02, ncarter wrote: > On 2016/09/29 05:00:07, Reilly Grant wrote: > > Adding ...
4 years, 2 months ago (2016-09-29 17:31:09 UTC) #41
ncarter (slow)
Charlie: PTAL. pretty sure the current patch set should be all green. Updated to include ...
4 years, 2 months ago (2016-09-29 21:01:46 UTC) #52
Charlie Reis
LGTM! Minor nits below. https://codereview.chromium.org/2364633004/diff/210001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc (right): https://codereview.chromium.org/2364633004/diff/210001/chrome/browser/browser_process_impl.cc#newcode226 chrome/browser/browser_process_impl.cc:226: // commit (including in iframes) ...
4 years, 2 months ago (2016-09-29 21:39:37 UTC) #53
Lei Zhang
lgtm https://codereview.chromium.org/2364633004/diff/210001/chrome/browser/chrome_security_exploit_browsertest.cc File chrome/browser/chrome_security_exploit_browsertest.cc (right): https://codereview.chromium.org/2364633004/diff/210001/chrome/browser/chrome_security_exploit_browsertest.cc#newcode87 chrome/browser/chrome_security_exploit_browsertest.cc:87: std::string target_origin = // The bookmark manager extension. ...
4 years, 2 months ago (2016-09-29 21:47:07 UTC) #56
Devlin
extensions lgtm
4 years, 2 months ago (2016-09-29 21:58:04 UTC) #57
ncarter (slow)
https://codereview.chromium.org/2364633004/diff/210001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc (right): https://codereview.chromium.org/2364633004/diff/210001/chrome/browser/browser_process_impl.cc#newcode226 chrome/browser/browser_process_impl.cc:226: // commit (including in iframes) in extension processes. On ...
4 years, 2 months ago (2016-09-29 22:04:02 UTC) #58
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2364633004/230001
4 years, 2 months ago (2016-09-29 22:04:35 UTC) #61
commit-bot: I haz the power
Committed patchset #13 (id:230001)
4 years, 2 months ago (2016-09-29 22:51:25 UTC) #63
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/a411fd062bc68fc2b5fc3aca7e4cbb8e4a3e074e Cr-Commit-Position: refs/heads/master@{#421964}
4 years, 2 months ago (2016-09-29 22:52:58 UTC) #65
tsergeant
A revert of this CL (patchset #13 id:230001) has been created in https://codereview.chromium.org/2385553002/ by tsergeant@chromium.org. ...
4 years, 2 months ago (2016-09-30 00:40:44 UTC) #66
ncarter (slow)
charlie: I'd like to re-land this. PTAL @ ps 13 vs 15, which should consist ...
4 years, 2 months ago (2016-09-30 22:30:40 UTC) #68
Charlie Reis
The updated layout test seems reasonable to me. LGTM.
4 years, 2 months ago (2016-09-30 22:41:43 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2364633004/270001
4 years, 2 months ago (2016-09-30 22:46:28 UTC) #72
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/306491)
4 years, 2 months ago (2016-10-01 00:43:01 UTC) #74
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2364633004/270001
4 years, 2 months ago (2016-10-03 17:44:26 UTC) #76
commit-bot: I haz the power
Committed patchset #15 (id:270001)
4 years, 2 months ago (2016-10-03 18:52:07 UTC) #78
commit-bot: I haz the power
Patchset 15 (id:??) landed as https://crrev.com/2a8ba8c4c186e5ea0a2ed938cc5d41441af64228 Cr-Commit-Position: refs/heads/master@{#422474}
4 years, 2 months ago (2016-10-03 18:56:37 UTC) #80
jam
https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS File chrome/browser/DEPS (right): https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS#newcode112 chrome/browser/DEPS:112: '+content/common', we never allow includes from within content from ...
4 years, 2 months ago (2016-10-04 23:28:54 UTC) #82
ncarter (slow)
https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS File chrome/browser/DEPS (right): https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS#newcode112 chrome/browser/DEPS:112: '+content/common', On 2016/10/04 23:28:54, jam wrote: > we never ...
4 years, 2 months ago (2016-10-05 18:22:09 UTC) #83
jam
https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS File chrome/browser/DEPS (right): https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS#newcode112 chrome/browser/DEPS:112: '+content/common', On 2016/10/05 18:22:09, ncarter wrote: > On 2016/10/04 ...
4 years, 2 months ago (2016-10-05 19:11:08 UTC) #84
jam
On 2016/10/05 19:11:08, jam wrote: > https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS > File chrome/browser/DEPS (right): > > https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS#newcode112 > ...
4 years, 2 months ago (2016-10-05 19:16:15 UTC) #85
ncarter (slow)
https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS File chrome/browser/DEPS (right): https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS#newcode112 chrome/browser/DEPS:112: '+content/common', On 2016/10/05 19:11:08, jam wrote: > On 2016/10/05 ...
4 years, 2 months ago (2016-10-05 20:45:34 UTC) #86
jam
4 years, 2 months ago (2016-10-05 22:35:46 UTC) #87
Message was sent while issue was closed.
On 2016/10/05 20:45:34, ncarter wrote:
> https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS
> File chrome/browser/DEPS (right):
> 
>
https://codereview.chromium.org/2364633004/diff/270001/chrome/browser/DEPS#ne...
> chrome/browser/DEPS:112: '+content/common',
> On 2016/10/05 19:11:08, jam wrote:
> > On 2016/10/05 18:22:09, ncarter wrote:
> > > On 2016/10/04 23:28:54, jam wrote:
> > > > we never allow includes from within content from outside, even for
tests.
> > > > 
> > > > Can you wrap the code you need with a helper method in
content/public/test
> > and
> > > > then call that from the browsertest?
> > > 
> > > Hi John -- can you respond to the argument made on line 109? Exploits are
> > > usually layering violations by definition; 
> > 
> > I don't really grep this sentence; it all depends on how you define layering
> > violations.
> 
> I'm saying that an attacker doesn't have to ask OWNERS for permission 
> to use an IPC in an exploit chain.
> 
> > Regardless of the semantics though, there are way of testing this without
> having
> > chrome reach into the internals of content by using public methods. This is
> the
> > pattern we've used for several years, so I don't see a reason to change that
> > now.
> 
> I see a sharp distinction between security exploit tests and other type of
> tests. I agree with your statement strongly when applied to the latter. But
for
> the former, this restriction makes about as much sense as requiring a fuzzer's
> output to comply with the js style guide.

Can you explain more why we need a distinction?

Stepping back, I understand and agree we need to be able to send various IPCs to
verify our security checks are valid. I just don't get why security exploit
tests don't have to follow the same code layering that we have for all the other
test & non-test code?

> 
> Maybe these types of tests belong in their own target?
> 
> > > the bug under test here is a bug in
> > > //content, that's can only be reproed in //chrome (because extensions) and
> the
> > > fix lives in //extensions.
> > 
> > Sure, that's fine.
> > 
> > > 
> > > Charlie, nasko and I had discussed this before carving out this exception,
> and
> > > it all seemed reasonable to us.
> > > 
> > > Test methods like you suggest are possible, but I'd need several of them
per
> > > test, and they have no chance of reusability,
> > 
> > I'm not sure how the fact that we have non-reusable test methods affects
> things?
> > It's a small effort to create public methods for this, so it's not a large
> > overhead.
> >
> > > and they just seem like the
> > > restriction ties the hands of testwriters here.
> > 
> > Why does have having a public test method restrict test authors?
> 
> Mostly I'm making a productivity argument. It's more work to do the same
thing,
> so it makes experimentation harder. 

We're talking about just adding a public method to send an IPC right? That
doesn't seem much more work?

This can be thought of almost like the fact that we do security reviews for IPC
file changes, and that adds more latency, but is accepted because it's
beneficial. Here we also have code outside content/ can't include internals,
just like content/ can't include internals of blink, but we accept the extra
work for this because of the other benefits.

> If we allow the #includes, we basically
> create an environment where it's straightforward to spoof any message, without
> adding a helper method to content/public/test for each method. In my view,
such
> an environment encourages testwriting. Also, if the messages aren't in
content/,
> but somewhere else, using the IPC message in this way might require creating a
> test_util target.

It just sounds like we have different opinions on how much effort it is to add a
wrapper function, so I don't want to go in circles.

With respect to this change, it'll be two methods in content/public/test. No
rule is set in stone, but if we want to allow code outside content/ to include
internal code, this is a large change from how we've done things for the last 5
years or so, so this should be something we discuss with all the top level
content owners to reach consensus. Until that happens, please route this through
content/public/test.

> 
> I don't know if we have a PwnMessageReceived story figured out for mojo yet,
but
> in a mojo world, I would hope that chrome_security_exploit_browsertest should
> have access to an internal Mojo interface that normally we would want to hide
> from a chrome browsertest.

Agreed we will have to make sure this is possible (if it's not already), as our
goal is not to make it any harder to do what we can with chrome ipc.

> 
> > >  We need to make these sorts of
> > > cases easier to test, not harder; curious if you have any ideas for ways
to
> do
> > > that that also fit inside our layering goals for the architecture.
> > 
> > Agreed we need more tests, however no need to break the separation of chrome
> vs
> > content internals that we've spent a few years creating, and then have
> > maintained for a few years since.
> 
> If you are an attacker, there is no separation of chrome vs. content
internals.

Sure, there's also no separation between content and webkit/source and v8/src
but that's orthogonal from writing tests.

Powered by Google App Engine
This is Rietveld 408576698