privetd: Compare user scope with minimalRole for local commands
Prived passes current auth scope corresponding to the current
/privet/v3/commands/execute requests to buffet.
Buffet compare scope with minimalRole of requested command and denies
request if scope is not enough.
BUG=brillo:808
TEST=`FEATURES=test emerge-gizmo buffet privetd`
Change-Id: Ib691184460fcd9d099e0688eaeadf831229672aa
Reviewed-on: https://chromium-review.googlesource.com/274234
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/buffet_client.cc b/buffet/buffet_client.cc
index 8408a46..ab8f189 100644
--- a/buffet/buffet_client.cc
+++ b/buffet/buffet_client.cc
@@ -365,7 +365,7 @@
void CallAddCommand(const std::string& command, ManagerProxy* manager_proxy) {
ErrorPtr error;
std::string id;
- if (!manager_proxy->AddCommand(command, &id, &error)) {
+ if (!manager_proxy->AddCommand(command, "owner", &id, &error)) {
return ReportError(error.get());
}
OnJobComplete();