diff --git a/apis/workflows/v1/automation.proto b/apis/workflows/v1/automation.proto index a1b7041..2f662e4 100644 --- a/apis/workflows/v1/automation.proto +++ b/apis/workflows/v1/automation.proto @@ -58,7 +58,7 @@ message StorageEventTrigger { tilebox.v1.ID id = 1; // The storage location to watch for events StorageLocation storage_location = 2; - // Glob pattern matched against object keys relative to the storage location's root_prefix. + // Glob pattern matched against object keys within the bucket or container, or paths relative to the local directory root. string glob_pattern = 3 [(buf.validate.field).string.min_len = 1]; } diff --git a/apis/workflows/v1/storage_access.proto b/apis/workflows/v1/storage_access.proto index a68a2b2..00ed29c 100644 --- a/apis/workflows/v1/storage_access.proto +++ b/apis/workflows/v1/storage_access.proto @@ -22,44 +22,57 @@ enum StorageAccessPermission { } // AWSRoleStorageAccess configures AWS role assumption. +// Require external ID "tilebox::" in the role's trust policy, using the owning organization's UUID. message AWSRoleStorageAccess { string role_arn = 1 [(buf.validate.field).string = { max_bytes: 2048 pattern: "^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$" }]; - // Grant this Tilebox principal permission to assume the role. - string principal_arn = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Tilebox generates this value for the role's trust policy and preserves it on updates. - string external_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Allow delegated sessions to write, delete, and manage multipart uploads. Defaults to read-only. - bool allow_write = 4; + // Allow read/write sessions. Defaults to read-only. + bool allow_write = 2; } -// GCSImpersonationStorageAccess configures service-account impersonation. -message GCSImpersonationStorageAccess { - string service_account_email = 1 [(buf.validate.field).string = { - email: true - max_bytes: 320 - suffix: ".iam.gserviceaccount.com" - }]; - // Grant this organization's Tilebox identity permission to impersonate the service account. - string delegator_service_account_email = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Allow delegated sessions to write and delete objects. Defaults to read-only. - bool allow_write = 3; +// GCSServiceAccountStorageAccess configures temporary GCS access using a service-account key. +message GCSServiceAccountStorageAccess { + // Service-account JSON key. Required on setup; omit on updates to keep it. Never returned. + string service_account_key_json = 1 [ + features.field_presence = EXPLICIT, + (google.api.field_behavior) = INPUT_ONLY, + (buf.validate.field).string = { + min_bytes: 1 + max_bytes: 65536 + } + ]; + // Allow read/write sessions. Defaults to read-only. + bool allow_write = 2; } -// AzureDelegationStorageAccess configures user-delegation SAS access. -message AzureDelegationStorageAccess { - // Must be linked to the caller's Tilebox organization. - string tenant_id = 1 [(buf.validate.field).string.uuid = true]; - // Grant this Tilebox application access to the storage account and container. - string application_client_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Allow delegated sessions to write and delete blobs. Defaults to read-only. - bool allow_write = 3; +// AzureClientSecretCredentials authenticates a service principal with a client secret. All fields are required. +message AzureClientSecretCredentials { + string tenant_id = 1 [ + (google.api.field_behavior) = INPUT_ONLY, + (buf.validate.field).string.uuid = true + ]; + string client_id = 2 [ + (google.api.field_behavior) = INPUT_ONLY, + (buf.validate.field).string.uuid = true + ]; + string client_secret = 3 [ + (google.api.field_behavior) = INPUT_ONLY, + (buf.validate.field).string.min_bytes = 1 + ]; } -// AccessKeyCredentials contains an access key ID and secret for S3-compatible authentication. -// Both fields are required when configuring access; omitted fields preserve saved values on updates to the same method. +// AzureUserDelegationSASStorageAccess configures user delegation SAS access to Azure Blob Storage. +message AzureUserDelegationSASStorageAccess { + // Required on setup. Omit on updates to keep credentials, or supply all fields to replace them. Never returned. + AzureClientSecretCredentials credentials = 1 [(google.api.field_behavior) = INPUT_ONLY]; + // Allow read/write sessions. Defaults to read-only. + bool allow_write = 2; +} + +// AccessKeyCredentials contains an S3-compatible key pair. +// Both fields are required on setup. Omitted fields keep their saved values on updates. message AccessKeyCredentials { string access_key_id = 1 [ features.field_presence = EXPLICIT, @@ -75,28 +88,16 @@ message AccessKeyCredentials { // StaticS3CredentialsAccess configures access with a saved S3 key pair. message StaticS3CredentialsAccess { - // Required when configuring this method. Updates replace supplied key fields. Location responses omit credentials. AccessKeyCredentials credentials = 1 [(google.api.field_behavior) = INPUT_ONLY]; } -// R2DelegationStorageAccess uses saved parent keys to issue temporary R2 credentials. -message R2DelegationStorageAccess { - // Required when configuring this method. Updates replace supplied key fields. Parent keys stay on the backend. +// R2TemporaryCredentialsStorageAccess configures temporary R2 credentials using a parent key pair. +message R2TemporaryCredentialsStorageAccess { AccessKeyCredentials credentials = 1 [(google.api.field_behavior) = INPUT_ONLY]; - // Allow delegated sessions to write, delete, and manage multipart uploads. Defaults to read-only. + // Allow read/write sessions. Defaults to read-only. bool allow_write = 2; } -// PublicHTTPStorageAccess configures unsigned reads through a public bucket endpoint. -message PublicHTTPStorageAccess { - // HTTPS bucket-root origin. Supports range reads but no listing. - string public_endpoint = 1 [(buf.validate.field).string = { - uri: true - max_bytes: 2048 - pattern: "^https://[^/?#@]+/?$" - }]; -} - // AWSS3StorageAccess configures access to an AWS bucket. message AWSS3StorageAccess { option (buf.validate.message).oneof = { @@ -123,7 +124,7 @@ message GCSStorageAccess { fields: [ "anonymous", "client_managed", - "gcs_impersonation", + "gcs_service_account", "static_s3" ] required: true @@ -131,7 +132,7 @@ message GCSStorageAccess { google.protobuf.Empty anonymous = 1; google.protobuf.Empty client_managed = 2; - GCSImpersonationStorageAccess gcs_impersonation = 3; + GCSServiceAccountStorageAccess gcs_service_account = 3; StaticS3CredentialsAccess static_s3 = 4; } @@ -141,35 +142,47 @@ message AzureBlobStorageAccess { fields: [ "anonymous", "client_managed", - "azure_delegation" + "azure_user_delegation_sas" ] required: true }; google.protobuf.Empty anonymous = 1; google.protobuf.Empty client_managed = 2; - AzureDelegationStorageAccess azure_delegation = 3; + AzureUserDelegationSASStorageAccess azure_user_delegation_sas = 3; } // R2StorageAccess configures access to a Cloudflare R2 bucket. message R2StorageAccess { option (buf.validate.message).oneof = { fields: [ - "anonymous", "client_managed", - "r2_delegation", + "r2_temporary_credentials", "static_s3" ] required: true }; - PublicHTTPStorageAccess anonymous = 1; - google.protobuf.Empty client_managed = 2; - R2DelegationStorageAccess r2_delegation = 3; - StaticS3CredentialsAccess static_s3 = 4; + google.protobuf.Empty client_managed = 1; + R2TemporaryCredentialsStorageAccess r2_temporary_credentials = 2; + StaticS3CredentialsAccess static_s3 = 3; +} + +// TigrisStorageAccess configures authenticated S3 access to a Tigris bucket. +message TigrisStorageAccess { + option (buf.validate.message).oneof = { + fields: [ + "client_managed", + "static_s3" + ] + required: true + }; + + google.protobuf.Empty client_managed = 1; + StaticS3CredentialsAccess static_s3 = 2; } -// S3CompatibleStorageAccess configures access to Tigris or another S3-compatible provider. +// S3CompatibleStorageAccess configures access through a provider's S3 API. message S3CompatibleStorageAccess { option (buf.validate.message).oneof = { fields: [ @@ -185,7 +198,7 @@ message S3CompatibleStorageAccess { StaticS3CredentialsAccess static_s3 = 3; } -// StorageS3Connection contains client settings and static or temporary credentials for any S3-compatible provider. +// StorageS3Connection contains S3-compatible client settings and credentials. message StorageS3Connection { string endpoint = 1; string bucket = 2; @@ -200,13 +213,13 @@ message StorageS3Connection { // StorageGCSConnection contains native GCS client settings and credentials. message StorageGCSConnection { string bucket = 1; - string bearer_token = 2; + string access_token = 2; } // StorageAzureConnection contains Azure Blob client settings and credentials. message StorageAzureConnection { string endpoint = 1; - string account = 2; + string account_name = 2; string container = 3; // SAS query string without a leading '?'. string sas_token = 4; @@ -215,16 +228,14 @@ message StorageAzureConnection { // CreateStorageAccessSessionRequest fetches or renews credentials for a location. message CreateStorageAccessSessionRequest { tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; - // Delegated READ_WRITE requires allow_write. READ always issues read-only delegated credentials. - // Static credentials retain their cloud permissions, regardless of the requested access. + // Delegated writes require allow_write. Static keys retain their existing permissions. StorageAccessPermission access = 2 [(buf.validate.field).enum = { defined_only: true not_in: [0] }]; } -// StorageAccessSession contains connection settings and Tilebox-supplied credentials for a native storage client. -// Keep credentials out of logs and persistent storage. +// StorageAccessSession contains client settings and credentials for a bucket or container. message StorageAccessSession { option (buf.validate.message).oneof = { fields: [ @@ -235,31 +246,9 @@ message StorageAccessSession { required: true }; - // Client paths are relative to this root. Reopen the store if the root or target changes on renewal. - string root_prefix = 1; - // Provider expiration for delegated credentials. Call CreateStorageAccessSession again to renew. - // Absent for static credentials; reopen the store to pick up a rotated key. - google.protobuf.Timestamp expires_at = 2; - StorageS3Connection s3 = 3; - StorageGCSConnection gcs = 4; - StorageAzureConnection azure = 5; -} - -// TestStorageAccessRequest tests a scoped listing, or a small range read when object_key is supplied. -message TestStorageAccessRequest { - tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; - // Existing object relative to root_prefix. Required for public HTTP endpoints without listing. - string object_key = 2 [ - features.field_presence = EXPLICIT, - (buf.validate.field).string = { - min_bytes: 1 - max_bytes: 4096 - not_contains: "\x00" - }, - (buf.validate.field).cel = { - id: "storage_access_test.object_key" - message: "Use a relative object key without empty, '.' or '..' components." - expression: "this.split('/').all(p, p != '' && p != '.' && p != '..')" - } - ]; + // Credential expiration. Request a new session to renew. Absent for static credentials. + google.protobuf.Timestamp expires_at = 1; + StorageS3Connection s3 = 2; + StorageGCSConnection gcs = 3; + StorageAzureConnection azure = 4; } diff --git a/apis/workflows/v1/storage_location.proto b/apis/workflows/v1/storage_location.proto index 9c43ced..625d37b 100644 --- a/apis/workflows/v1/storage_location.proto +++ b/apis/workflows/v1/storage_location.proto @@ -47,11 +47,8 @@ message StorageLocation { StorageLocationReference reference = 5; } -// StorageLocationReference identifies an existing storage resource. Set the field corresponding to type. -// Coordinates and root_prefix are fixed after creation. A supplied reference replaces the complete access configuration. -// Omitted credential fields keep saved values only when the authentication method is unchanged. -// Creating or switching to a credential-backed method requires a complete pair. Location responses omit credentials. -// Absent access disables Tilebox object access; anonymous and client-managed access must be selected explicitly. +// StorageLocationReference identifies a resource and its access settings. Set the field matching type. +// Resource coordinates cannot change after creation. Omit access for notification-only use. message StorageLocationReference { option (buf.validate.message).oneof = { fields: [ @@ -82,18 +79,6 @@ message StorageLocationReference { S3CompatibleBucketReference s3_compatible_bucket = 6; R2BucketReference r2_bucket = 7; TigrisBucketReference tigris_bucket = 8; - // Empty for the resource root; otherwise a relative directory prefix ending in '/'. - // Scopes client paths and subscriptions. Ignore notifications outside this prefix and strip it before matching globs. - // Delegated credentials enforce the prefix; static and client-managed credentials retain their cloud scope. - string root_prefix = 9 [ - (buf.validate.field).string.max_bytes = 1024, - (buf.validate.field).string.not_contains = "\x00", - (buf.validate.field).cel = { - id: "storage_location_reference.root_prefix" - message: "Use an empty root or a relative directory prefix ending in '/' without empty, '.' or '..' components." - expression: "this == '' || (this.endsWith('/') && !this.startsWith('/') && !this.contains('//') && this.split('/').all(p, p != '.' && p != '..'))" - } - ]; } // S3CompatibleBucketReference identifies a bucket at an S3 endpoint. @@ -108,43 +93,24 @@ message S3CompatibleBucketReference { max_bytes: 2048 pattern: "^https?://[^/?#@]+/?$" }]; - // Region used for SigV4 signing, independent of the endpoint hostname. Empty or omitted defaults to "auto". + // Signing region. Defaults to "auto". string region = 3 [(buf.validate.field).string.max_bytes = 128]; bool force_path_style = 4; - // Public bucket-root origin for anonymous HTTP reads. - string public_endpoint = 5 [ - features.field_presence = EXPLICIT, - (buf.validate.field).string = { - uri: true - max_bytes: 2048 - pattern: "^https?://[^/?#@]+/?$" - } - ]; - S3CompatibleStorageAccess access = 6; + S3CompatibleStorageAccess access = 5; } // R2BucketReference identifies a Cloudflare R2 bucket. message R2BucketReference { - option (buf.validate.message).cel = { - id: "r2_bucket_reference.endpoint" - message: "An S3 endpoint is required for delegated, static, or client-managed access." - expression: "!has(this.access) || has(this.access.anonymous) || this.endpoint != ''" - }; - string bucket = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 63 }]; - // Account's R2 S3 endpoint, including its jurisdiction when applicable. Required for S3 access. - // Signing region is auto. - string endpoint = 2 [ - (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, - (buf.validate.field).string = { - uri: true - max_bytes: 2048 - pattern: "^https://[^/?#@]+/?$" - } - ]; + // R2 S3 endpoint, including jurisdiction if applicable. + string endpoint = 2 [(buf.validate.field).string = { + uri: true + max_bytes: 2048 + pattern: "^https://[^/?#@]+/?$" + }]; R2StorageAccess access = 3; } @@ -154,7 +120,7 @@ message TigrisBucketReference { min_bytes: 1 max_bytes: 63 }]; - S3CompatibleStorageAccess access = 2; + TigrisStorageAccess access = 2; } // AWSS3BucketReference identifies an Amazon Web Services S3 bucket and its region. @@ -181,14 +147,14 @@ message GCSBucketReference { min_bytes: 1 max_bytes: 128 }]; - // Optional bucket location, such as europe-west2, EUR4, or EU. May be a region, dual-region, or multi-region. + // Optional bucket location, such as europe-west2, EUR4, or EU. string location = 3 [(buf.validate.field).string.max_bytes = 128]; GCSStorageAccess access = 4; } // AzureBlobReference identifies a container in an Azure storage account. message AzureBlobReference { - // Full ARM resource ID of the storage account, not its URL or a connection string. + // Full ARM resource ID of the storage account. string storage_account_resource_id = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 2048 @@ -197,7 +163,7 @@ message AzureBlobReference { min_bytes: 1 max_bytes: 63 }]; - // Optional primary region of the storage account, such as westeurope. Containers use their account's region. + // Optional storage account region, such as westeurope. string region = 3 [(buf.validate.field).string.max_bytes = 128]; AzureBlobStorageAccess access = 4; } @@ -223,7 +189,7 @@ message TriggeredJobs { } // CreateStorageLocationRequest registers an existing bucket, container, or directory. -// Omit the provider's access field for notification-only use. Cloud permissions can be configured after creation. +// Supply complete credentials when selecting a credential-backed access method. message CreateStorageLocationRequest { string name = 1 [(buf.validate.field).string = { min_bytes: 1 @@ -232,6 +198,46 @@ message CreateStorageLocationRequest { StorageLocationReference reference = 2 [(buf.validate.field).required = true]; } +// TestStorageAccessRequest tests a saved location or an unsaved configuration without storing it. +message TestStorageAccessRequest { + option (buf.validate.message).oneof = { + fields: [ + "storage_location_id", + "create_request" + ] + required: true + }; + + tilebox.v1.ID storage_location_id = 1; + // Read this object without listing. If omitted, list one page and read a nonempty object when available. + string object_key = 2 [ + features.field_presence = EXPLICIT, + (buf.validate.field).string = { + min_bytes: 1 + max_bytes: 4096 + not_contains: "\x00" + }, + (buf.validate.field).cel = { + id: "storage_access_test.object_key" + message: "Use a relative object key without empty, '.' or '..' components." + expression: "this.split('/').all(p, p != '' && p != '.' && p != '..')" + } + ]; + // The same input as creation, including complete credentials for the selected access method. + CreateStorageLocationRequest create_request = 3 [(google.api.field_behavior) = INPUT_ONLY]; + // Also create and delete a temporary object. A failed cleanup may leave it behind. + bool verify_write = 4; +} + +// TestStorageAccessResponse reports each check: absent means skipped, true means passed, and false means failed. +// Invalid requests, authorization failures, and failures to obtain credentials return RPC errors. +message TestStorageAccessResponse { + bool list = 1 [features.field_presence = EXPLICIT]; + bool read = 2 [features.field_presence = EXPLICIT]; + bool write = 3 [features.field_presence = EXPLICIT]; + bool delete = 4 [features.field_presence = EXPLICIT]; +} + // UpdateStorageLocationRequest changes supplied fields and leaves the rest unchanged. message UpdateStorageLocationRequest { option (buf.validate.message).cel = { @@ -248,9 +254,10 @@ message UpdateStorageLocationRequest { max_bytes: 1024 } ]; - // Omit to keep the reference. Supply a complete reference with unchanged coordinates and root_prefix to replace access. - // Credential fields are patched within the same access method: supplied values replace saved values; omitted fields keep them. - // Omitting access within a supplied reference removes access and saved credentials; issued keys may remain valid. + // Supply the complete reference with unchanged resource coordinates to replace access settings. + // Only omitted credentials are retained within the same method; other omitted settings use their defaults. + // Switching methods requires complete credentials. + // Omitting access removes saved credentials. Issued credentials may remain valid. StorageLocationReference reference = 3; } @@ -405,7 +412,7 @@ message StorageSubscriptions { message StorageSubscriptionEvent { // Unique identifier of the received event. tilebox.v1.ID id = 1; - // Object key relative to the location's root_prefix, or to the local directory root when no prefix is set. + // Object key within the bucket or container, or path relative to the local directory root. string object_key = 2 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 4096 @@ -455,7 +462,7 @@ message TriggeredStorageEvent { tilebox.v1.ID storage_location_id = 1; // The type of the storage event, e.g. created StorageEventType type = 2; - // Object key relative to the location root, with root_prefix removed. + // Object key within the bucket or container, or path relative to the local directory root. string location = 3; } @@ -467,17 +474,17 @@ service StorageLocationService { rpc GetStorageLocation(tilebox.v1.ID) returns (StorageLocation); // CreateStorageLocation registers an existing resource with optional object access. rpc CreateStorageLocation(CreateStorageLocationRequest) returns (StorageLocation); - // UpdateStorageLocation changes the name or access settings. Subscriptions are unchanged. + // UpdateStorageLocation changes the name or access settings. Access changes require ownership. rpc UpdateStorageLocation(UpdateStorageLocationRequest) returns (StorageLocation); // DeleteStorageLocation removes the location and its subscriptions from Tilebox without deleting cloud resources. rpc DeleteStorageLocation(tilebox.v1.ID) returns (google.protobuf.Empty); - // TestStorageAccess checks listing or reading without writing objects. Requires management permission. - // Failures use RPC errors. Client-managed access cannot be tested by Tilebox. - rpc TestStorageAccess(TestStorageAccessRequest) returns (google.protobuf.Empty); - // CreateStorageAccessSession checks data-access permission and returns static or delegated credentials. - // Returns FAILED_PRECONDITION for absent, anonymous, or client-managed access; configure those clients from the location. - // Call again to renew. Responses use Cache-Control: no-store; errors omit provider secrets. + // TestStorageAccess checks object access. A page without nonempty objects skips the read check. + // Saved locations require read permission; drafts require creation access. + // Server tests require public HTTPS endpoints on port 443. Local and client-managed access cannot be tested. + rpc TestStorageAccess(TestStorageAccessRequest) returns (TestStorageAccessResponse); + // CreateStorageAccessSession returns client credentials. Location readers may request read or read/write access. + // Returns FAILED_PRECONDITION for absent, anonymous, or client-managed access. rpc CreateStorageAccessSession(CreateStorageAccessSessionRequest) returns (StorageAccessSession); // CreateStorageSubscription registers notification delivery and returns the provider setup values.