SPEKTRA Edge Multi-Service Authorization
Main authorization happens when the user sends a request to a service,
the authorization is located on the front. However, sometimes a service
executing a request needs to send the next requests to other services.
One often example is EstablishReferences
call in Schema Mixin service.
It is assumed that services don’t trust each other, and it shows here
too. Even if let’s say device service allows UpdateDevice, then IAM
needs to check on its own if UpdateDevice can update the reference to
field spec.service_account
(field in Device resource, pointing as
ServiceAccount from IAM). We are using the fact that cross-region and
cross-service references establishment require a call to
EstablishReferences
.
We have even special authorization for that: see file
mixins/schema/server/v1/resource_shadow/resource_shadow_service_custom_auth.go
.
In this file, we check referenced resources and try to see if this is
allowed for service-making calls, or from the user originally making
the request. In the future, we may opt-out from the original user, and
require that the service has access to referenced resources.
It typically should be the case, ServiceAccount pointed by Device should
be owned by devices (metadata.services.owning_service
). The same goes
for logging or monitoring buckets. We may need proper permission attach
checks for resources first, and support for resource field conditions!
Other than that, service-to-service subsequent calls are treated separately, and service verifies a service.