seneschal: Add storage location field
Add a storage location field to the SharePath message so that it's not
trivially easy for users to share their cookies and other private data
with a VM. The path included with the message is now treated as being
relative to the storage location and cannot contain ".." components or
end with ".".
Additionally, rename service.proto to seneschal_service.proto. It turns
out the protobuf compiler only uses the file name when generating the
include guard so it's not possible to include headers from 2 different
files named service.proto even if they are in different packages.
BUG=chromium:703939
TEST=`vmc share termina ../Cookies` doesn't work
Change-Id: I096006dceb1af75c4c80dcec95ed9b8a8129616a
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1166451
Reviewed-by: Dylan Reid <dgreid@chromium.org>
diff --git a/dbus/seneschal/service.proto b/dbus/seneschal/seneschal_service.proto
similarity index 90%
rename from dbus/seneschal/service.proto
rename to dbus/seneschal/seneschal_service.proto
index 4d0a6e2..bb46029 100644
--- a/dbus/seneschal/service.proto
+++ b/dbus/seneschal/seneschal_service.proto
@@ -102,8 +102,19 @@
// The handle to the server with whom the path should be shared.
uint32 handle = 1;
- // The actual path to be shared.
+ // The actual path to be shared. Must be relative to |storage_location|
+ // and must not contain any "../" elements or end with ".".
SharedPath shared_path = 2;
+
+ // The location where the path to be shared lives.
+ enum StorageLocation {
+ // The user's Downloads/ directory.
+ DOWNLOADS = 0;
+ }
+ StorageLocation storage_location = 3;
+
+ // The user's cryptohome. This is the <hash> part of /home/user/<hash>.
+ string owner_id = 4;
}
// Information sent back by seneschal when it receives a SharePath request.
diff --git a/system_api.gyp b/system_api.gyp
index 7b5bf63..2f7da53 100644
--- a/system_api.gyp
+++ b/system_api.gyp
@@ -317,7 +317,7 @@
'proto_out_dir': 'include/seneschal/proto_bindings',
},
'sources': [
- '<(proto_in_dir)/service.proto',
+ '<(proto_in_dir)/seneschal_service.proto',
],
'includes': ['../../platform2/common-mk/protoc.gypi'],
},
@@ -329,7 +329,7 @@
'system_api-seneschal-protos-gen',
],
'sources': [
- '<(SHARED_INTERMEDIATE_DIR)/include/seneschal/proto_bindings/service.pb.cc',
+ '<(SHARED_INTERMEDIATE_DIR)/include/seneschal/proto_bindings/seneschal_service.pb.cc',
]
},
],