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

Unified Diff: services/shell/shell.cc

Issue 1918333002: Add explicit capability class enforcement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | services/shell/tests/connect/connect_test_app_a_manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/shell.cc
diff --git a/services/shell/shell.cc b/services/shell/shell.cc
index b64e5a4a14d42b544487ca966eb631d8e63e98d8..4d9d42457d5c2bbd62d1223b3d63c177f69bd997 100644
--- a/services/shell/shell.cc
+++ b/services/shell/shell.cc
@@ -38,6 +38,7 @@ const char kCapabilityClass_UserID[] = "shell:user_id";
const char kCapabilityClass_ClientProcess[] = "shell:client_process";
const char kCapabilityClass_InstanceName[] = "shell:instance_name";
const char kCapabilityClass_AllUsers[] = "shell:all_users";
+const char kCapabilityClass_ExplicitClass[] = "shell:explicit_class";
void EmptyResolverCallback(mojom::ResolveResultPtr result) {}
@@ -158,6 +159,14 @@ class Shell::Instance : public mojom::Connector,
source->capability_spec_, identity_, capability_spec_);
source_id = source->id();
}
+
+ // The target has specified that sources must request one of its provided
+ // classes instead of specifying a wild-card for interfaces.
+ if (HasClass(capability_spec_, kCapabilityClass_ExplicitClass) &&
+ (request.interfaces.count("*") != 0)) {
+ request.interfaces = Interfaces();
+ }
+
shell_client_->AcceptConnection(
mojom::Identity::From(params->source()), source_id,
params->TakeRemoteInterfaces(), params->TakeLocalInterfaces(),
« no previous file with comments | « no previous file | services/shell/tests/connect/connect_test_app_a_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698