Files
archie/proto/state/v1/account.proto
T
sam c180a2debb
Quality / check (push) Successful in 3m49s
deploy / gate (push) Successful in 4m48s
deploy / archied-image (push) Successful in 2m55s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
feat(access): scoped canary grant replaces instance-admin CANARY_TOKEN (#1727)
The canary now authenticates as a dedicated service-account identity in the
system org whose only grant is access.CalaryGrantPolicy: read the signal
endpoints (chat update, alerts, logs, tasks), read and write the
update-settings resource, and trigger an update install. CANARY_TOKEN no
longer carries instance admin; DEPLOY_TOKEN stays CI-only.

- authorize: POST /api/chat/update/install and /defer map to
  update on Object::"update" (dashboard) instead of run on any workflow,
  so the grant can cover installs without granting workflow runs
- accounts: active service-account identities may authenticate with bearer
  tokens (CanAct), not just users
- new POST /api/identities/{id}/tokens (behind manage_identities) mints a
  token for a named non-user identity; new AccountService RPC
  BindIdentityPersonalToken backs it remotely, refusing user-kind targets,
  with the caller recorded as audit actor
- engine tests pin the grant's exact allow/deny surface

RELEASING.md documents the one-time setup. task check passes on this tree.
2026-11-02 06:03:41 +11:00

116 lines
5.6 KiB
Protocol Buffer

syntax = "proto3";
package state.v1;
import "google/protobuf/timestamp.proto";
import "state/v1/types.proto";
service AccountService {
rpc GetAuthenticationSettings(GetAuthenticationSettingsRequest) returns (GetAuthenticationSettingsResponse);
rpc SaveAuthenticationSettings(SaveAuthenticationSettingsRequest) returns (SaveAuthenticationSettingsResponse);
rpc BeginPasskey(BeginPasskeyRequest) returns (BeginPasskeyResponse);
rpc FinishPasskey(FinishPasskeyRequest) returns (FinishPasskeyResponse);
rpc ListPasskeys(ListPasskeysRequest) returns (ListPasskeysResponse);
rpc DeletePasskey(DeletePasskeyRequest) returns (DeletePasskeyResponse);
rpc OpenAccountSession(OpenAccountSessionRequest) returns (OpenAccountSessionResponse);
rpc RequireFreshAccountSession(RequireFreshAccountSessionRequest) returns (RequireFreshAccountSessionResponse);
rpc CreateAccountRecovery(CreateAccountRecoveryRequest) returns (CreateAccountRecoveryResponse);
rpc RecoverAccount(RecoverAccountRequest) returns (RecoverAccountResponse);
rpc AccountSetup(AccountSetupRequest) returns (AccountSetupResponse);
rpc RegisterAccount(RegisterAccountRequest) returns (RegisterAccountResponse);
rpc SignInAccount(SignInAccountRequest) returns (SignInAccountResponse);
rpc ResolveAccountSession(ResolveAccountSessionRequest) returns (ResolveAccountSessionResponse);
rpc SignOutAccount(SignOutAccountRequest) returns (SignOutAccountResponse);
rpc ChangeAccountPassword(ChangeAccountPasswordRequest) returns (ChangeAccountPasswordResponse);
// Personal API tokens act on the caller's own principal: the State Store
// refuses a call that carries none.
rpc AddPersonalToken(AddPersonalTokenRequest) returns (AddPersonalTokenResponse);
rpc ListPersonalTokens(ListPersonalTokensRequest) returns (ListPersonalTokensResponse);
rpc RevokePersonalToken(RevokePersonalTokenRequest) returns (RevokePersonalTokenResponse);
// BindIdentityPersonalToken binds a personal token to a NAMED identity
// instead of the caller's principal, which is how a service account gets
// its bearer credential. Only non-user targets are accepted: a person's
// token comes from AddPersonalToken. The audit actor is the caller's
// principal, never a request field.
rpc BindIdentityPersonalToken(BindIdentityPersonalTokenRequest) returns (BindIdentityPersonalTokenResponse);
}
// PersonalToken identifies a token by the SHA-256 it binds as; the token
// itself never reaches the State Store.
message PersonalToken {
string id = 1;
google.protobuf.Timestamp created_at = 2;
string name = 3;
google.protobuf.Timestamp expires_at = 4; // unset: never expires
google.protobuf.Timestamp last_used_at = 5; // unset: never used
}
message AddPersonalTokenRequest {
string id = 1;
string name = 2;
google.protobuf.Timestamp expires_at = 3; // unset: never expires
}
message AddPersonalTokenResponse {}
message ListPersonalTokensRequest {}
message ListPersonalTokensResponse { repeated PersonalToken tokens = 1; }
message RevokePersonalTokenRequest { string id = 1; }
message RevokePersonalTokenResponse {}
message BindIdentityPersonalTokenRequest {
string identity_id = 1;
string id = 2;
string name = 3;
google.protobuf.Timestamp expires_at = 4; // unset: never expires
}
message BindIdentityPersonalTokenResponse {}
message AccountSetupRequest {}
message AccountSetupResponse { bool required = 1; }
message RegisterAccountRequest {
string email = 1;
string display_name = 2;
string password = 3;
string role = 4;
bool bootstrap = 5;
string organisation_name = 6;
string workspace_name = 7;
string public_url = 8;
}
message RegisterAccountResponse { Identity identity = 1; }
message SignInAccountRequest { string email = 1; string password = 2; }
message SignInAccountResponse {
Identity identity = 1;
string token = 2;
google.protobuf.Timestamp expires_at = 3;
}
message ResolveAccountSessionRequest { string token = 1; }
message ResolveAccountSessionResponse { Identity identity = 1; }
message SignOutAccountRequest { string token = 1; }
message SignOutAccountResponse {}
message ChangeAccountPasswordRequest { string current_password = 1; string new_password = 2; }
message ChangeAccountPasswordResponse {}
message AuthenticationSettings {
string public_url = 1;
string oidc_issuer = 2;
string oidc_audience = 3;
string oidc_client_id = 4;
}
message GetAuthenticationSettingsRequest {}
message GetAuthenticationSettingsResponse { AuthenticationSettings settings = 1; }
message SaveAuthenticationSettingsRequest { AuthenticationSettings settings = 1; }
message SaveAuthenticationSettingsResponse {}
message BeginPasskeyRequest { bool registration = 1; }
message BeginPasskeyResponse { string token = 1; bytes options = 2; }
message FinishPasskeyRequest { string token = 1; bytes credential = 2; bool registration = 3; string name = 4; }
message FinishPasskeyResponse { Identity identity = 1; string token = 2; google.protobuf.Timestamp expires_at = 3; }
message Passkey { string id = 1; string name = 2; }
message ListPasskeysRequest {}
message ListPasskeysResponse { repeated Passkey passkeys = 1; }
message DeletePasskeyRequest { string id = 1; }
message DeletePasskeyResponse {}
message OpenAccountSessionRequest { google.protobuf.Timestamp expires_at = 1; }
message OpenAccountSessionResponse { Identity identity = 1; string token = 2; google.protobuf.Timestamp expires_at = 3; }
message RequireFreshAccountSessionRequest { string token = 1; }
message RequireFreshAccountSessionResponse {}
message CreateAccountRecoveryRequest {}
message CreateAccountRecoveryResponse { string code = 1; }
message RecoverAccountRequest { string email = 1; string code = 2; string password = 3; }
message RecoverAccountResponse {}