forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add [ServiceSandbox=type] attribute to mojom interfaces
See doc linked in bug 1210301. This allows a mojom interface to specify the sandbox its service should be launched in:- [ServiceSandbox=sandbox.mojom.Sandbox.kService] interface FakeService { Foo() => (); } This is achieved by: * Allowing fully-qualified names as attribute values in .mojom files. This was not allowed before so shouldn't change any existing behavior. * Adding the Sandbox attribute to the mojom cpp generator. * constexpr kServiceSandbox members on the generated mojom classes. * mapping mojom sandbox types to chrome sandbox types. * Modifying content::ServiceProcessHost to fall back to asking mojo which sandbox to use if a specialization of GetServiceSandboxType() has not already been provided. If no kServiceSandbox exists compilation still fails if no sandbox is specified for the interface being ::Launch()ed. Sandbox attributes are verified at C++ compilation time. This makes it much easier to select an approved sandbox, and difficult but still possible to select a build or platform varying sandbox, while still requiring security review. A following change will add a presubmit to prevent direct inclusion of GetInterfaceSandbox specializations. This also adopts this attribute for the TestService and for the DataDecoderService. tests: content_browsertests ServiceProcessHostBrowserTest.* Bug: 1210301 Change-Id: Ie014724de603facae1edb6808733d4212ec20ee1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2912898 Reviewed-by: Ken Rockot <rockot@google.com> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Alex Gough <ajgo@chromium.org> Cr-Commit-Position: refs/heads/master@{#907309}
- Loading branch information
Showing
18 changed files
with
116 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2021 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//mojo/public/tools/bindings/mojom.gni") | ||
|
||
mojom("mojom") { | ||
generate_java = true | ||
sources = [ "sandbox.mojom" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
per-file *.mojom=set noparent | ||
per-file *.mojom=file://ipc/SECURITY_OWNERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module sandbox.mojom; | ||
|
||
// Sandbox type that can be specified as an attribute of mojo interfaces. | ||
// To specify the sandbox a service should be launched in, use the | ||
// [ServiceSandbox=type] attribute. | ||
// If your service does not need access to OS resources it should be | ||
// possible to host it in |kService|. These values are mapped to | ||
// //sandbox/policy/sandbox_type.h values. | ||
enum Sandbox { | ||
// |kService| hosts 'computation only' services such as decoders that | ||
// use limited operating system services. Prefer to use this sandbox | ||
// if possible. | ||
kService, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters