One gRPC service per domain in state.v1 (tasks, executions, accounts, identities, packages, captures, bindings, access, orgs, alerts and so on), each with its own server type in staterpc. RPC and message names and numbers are unchanged.
92 lines
3.5 KiB
Protocol Buffer
92 lines
3.5 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package state.v1;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// The stored policy chain and its denial records
|
|
// (docs/prds/orgs-and-access.md). ListPolicies is the engine's snapshot;
|
|
// the writes are administrative. RecordDenial is the dashboard's and
|
|
// dispatch's write path; ListDenials is the operator surface.
|
|
service AccessService {
|
|
// The principal assembly the Authorizer evaluates: an identity, the org
|
|
// it serves, and its memberships (internal/domain/access).
|
|
rpc GetPrincipal(GetPrincipalRequest) returns (GetPrincipalResponse);
|
|
rpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse);
|
|
// GetPoliciesVersion is the instance-wide policy version an authorizer reads
|
|
// before each decision to know whether the chain it holds is current. A
|
|
// caller must read it before ListPolicies, never after.
|
|
rpc GetPoliciesVersion(GetPoliciesVersionRequest) returns (GetPoliciesVersionResponse);
|
|
rpc PutPolicy(PutPolicyRequest) returns (PutPolicyResponse);
|
|
rpc DeletePolicy(DeletePolicyRequest) returns (DeletePolicyResponse);
|
|
rpc EnsureShippedOrgPolicies(EnsureShippedOrgPoliciesRequest) returns (EnsureShippedOrgPoliciesResponse);
|
|
rpc RecordDenial(RecordDenialRequest) returns (RecordDenialResponse);
|
|
rpc ListDenials(ListDenialsRequest) returns (ListDenialsResponse);
|
|
}
|
|
|
|
message GetPrincipalRequest { string identity_id = 1; }
|
|
// PrincipalMembership mirrors org.Membership: an identity's role in an org,
|
|
// or in one workspace of it.
|
|
message PrincipalMembership {
|
|
string org_id = 1;
|
|
string workspace_id = 2;
|
|
string role = 3;
|
|
}
|
|
// PrincipalWorkspace is one workspace of the principal's org, as policies
|
|
// read it.
|
|
message PrincipalWorkspace {
|
|
string workspace_id = 1;
|
|
string environment = 2;
|
|
}
|
|
message AccessPrincipal {
|
|
string identity_id = 1;
|
|
string org_id = 2;
|
|
repeated PrincipalMembership memberships = 3;
|
|
// workspaces are the workspaces of org_id.
|
|
repeated PrincipalWorkspace workspaces = 4;
|
|
}
|
|
message GetPrincipalResponse { AccessPrincipal principal = 1; }
|
|
// AccessPolicy mirrors internal/domain/access.Policy: one Cedar policy
|
|
// document and the level-scope tuple that places it in the chain.
|
|
message AccessPolicy {
|
|
string policy_id = 1;
|
|
string level = 2;
|
|
string org_id = 3;
|
|
string workspace_id = 4;
|
|
string object_kind = 5;
|
|
string object_id = 6;
|
|
string text = 7;
|
|
}
|
|
message ListPoliciesRequest {}
|
|
message ListPoliciesResponse { repeated AccessPolicy policies = 1; }
|
|
message GetPoliciesVersionRequest {}
|
|
message GetPoliciesVersionResponse { int64 version = 1; }
|
|
message PutPolicyRequest { AccessPolicy policy = 1; }
|
|
message PutPolicyResponse { int64 version = 1; }
|
|
message DeletePolicyRequest { AccessPolicy policy = 1; }
|
|
message DeletePolicyResponse {}
|
|
message EnsureShippedOrgPoliciesRequest { string org_id = 1; }
|
|
message EnsureShippedOrgPoliciesResponse {}
|
|
// AccessDenial mirrors internal/domain/access.Denial: one refusal with the
|
|
// level that decided it and the deciding policies. The store coalesces
|
|
// identical denials within a minute into one row with a count.
|
|
message AccessDenial {
|
|
string org_id = 1;
|
|
string principal = 2;
|
|
string action = 3;
|
|
string resource_kind = 4;
|
|
string resource_id = 5;
|
|
string level = 6;
|
|
repeated string policies = 7;
|
|
int64 count = 8;
|
|
google.protobuf.Timestamp at = 9;
|
|
}
|
|
message RecordDenialRequest { AccessDenial denial = 1; }
|
|
message RecordDenialResponse {}
|
|
message ListDenialsRequest {
|
|
reserved 1;
|
|
reserved "org_id";
|
|
int32 limit = 2;
|
|
}
|
|
message ListDenialsResponse { repeated AccessDenial denials = 1; }
|