Repository navigation
[Server] Create GCP service account key credentials #2260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
92ddd52
e487418
6c5c321
60a5c3c
8c340ad
3574e27
8715b02
17b5b31
b68612b
f4568b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # GcpServiceAccountKeyRequest | ||
| ## Properties | ||
|
|
||
| | Name | Type | Description | Notes | | ||
| |------------ | ------------- | ------------- | -------------| | ||
| | **email** | **String** | The email of the Google Cloud service account. | [default to null] | | ||
| | **private\_key\_id** | **String** | The ID of the service account key. | [default to null] | | ||
| | **private\_key** | **String** | The PEM-encoded PKCS#8 private key of the service account key. Write-only; never returned. | [default to null] | | ||
|
|
||
| [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # GcpServiceAccountKeyResponse | ||
| ## Properties | ||
|
|
||
| | Name | Type | Description | Notes | | ||
| |------------ | ------------- | ------------- | -------------| | ||
| | **email** | **String** | The email of the Google Cloud service account. | [default to null] | | ||
| | **private\_key\_id** | **String** | The ID of the service account key. | [default to null] | | ||
|
|
||
| [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1247,8 +1247,13 @@ paths: | |
| summary: Create a credential | ||
| description: |- | ||
| Creates a new credential. The type of credential to be created is determined by the **purpose** field. | ||
| Set exactly one of `aws_iam_role` and `s3_compatible`; otherwise the request fails with | ||
| `INVALID_ARGUMENT`. | ||
| Set exactly one of `aws_iam_role`, `s3_compatible` and `gcp_service_account_key`; otherwise the | ||
| request fails with `INVALID_ARGUMENT`. | ||
|
|
||
| A `gcp_service_account_key` credential holds a Google Cloud service account key: the server | ||
| encrypts its `private_key` with `server.credential-encryption-key` and never returns it, and | ||
| its external locations must be `gs://` paths. For now it is only stored: a request for access | ||
| under such a location fails with `UNIMPLEMENTED`. | ||
|
|
||
| EXPERIMENTAL: `s3_compatible` is available only when the server property | ||
| `server.s3-compatible-storage.enabled` is `true`. Otherwise a create or update request that | ||
|
|
@@ -1371,6 +1376,9 @@ paths: | |
| and leaving out `assume_role` removes it. Updates without either, such as of the name or | ||
| comment, keep the stored credential. | ||
|
|
||
| A `gcp_service_account_key` credential cannot change its type or private key through this | ||
| endpoint. Its name and comment can still be updated. | ||
|
|
||
| EXPERIMENTAL: whoever may update a credential is trusted with where the data under it lives. | ||
| Changing `s3_endpoint` of an `s3_compatible` credential moves data access for every path | ||
| under its external locations, including tables and volumes other principals own, to the new | ||
|
|
@@ -1419,8 +1427,9 @@ paths: | |
| summary: Create an external location | ||
| description: | | ||
| Creates a new external location entry in the metastore. The caller must be a metastore admin to be able to create external locations. | ||
| EXPERIMENTAL: a location whose credential is `s3_compatible` must have an `s3://` URL; | ||
| otherwise the request fails with `INVALID_ARGUMENT`. | ||
| A location whose credential is `gcp_service_account_key` must have a `gs://` URL, and | ||
| (EXPERIMENTAL) one whose credential is `s3_compatible` must have an `s3://` URL; otherwise | ||
| the request fails with `INVALID_ARGUMENT`. | ||
| operationId: createExternalLocation | ||
| requestBody: | ||
| required: true | ||
|
|
@@ -1526,8 +1535,9 @@ paths: | |
| or have MANAGE on the external location. | ||
| Unless force is true, changing the url fails if the location is in use (as described for | ||
| deleting it), unless the new url is the same as, or a parent of, the old one. | ||
| EXPERIMENTAL: a location whose credential is `s3_compatible` must have an `s3://` URL; | ||
| otherwise the request fails with `INVALID_ARGUMENT`. | ||
| A location whose credential is `gcp_service_account_key` must have a `gs://` URL, and | ||
| (EXPERIMENTAL) one whose credential is `s3_compatible` must have an `s3://` URL; otherwise | ||
| the request fails with `INVALID_ARGUMENT`. | ||
| operationId: updateExternalLocation | ||
| requestBody: | ||
| required: true | ||
|
|
@@ -3015,6 +3025,8 @@ components: | |
| $ref: '#/components/schemas/AwsIamRoleResponse' | ||
| s3_compatible: | ||
| $ref: '#/components/schemas/S3CompatibleResponse' | ||
| gcp_service_account_key: | ||
| $ref: '#/components/schemas/GcpServiceAccountKeyResponse' | ||
| comment: | ||
| description: Comment associated with the credential. | ||
| type: string | ||
|
|
@@ -3058,6 +3070,8 @@ components: | |
| $ref: '#/components/schemas/AwsIamRoleRequest' | ||
| s3_compatible: | ||
| $ref: '#/components/schemas/S3CompatibleRequest' | ||
| gcp_service_account_key: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (not a blocker): Typed UI callers cannot send or read a GCP credential The OpenAPI spec defines the field on both create and response models. The catalog types checked into the UI still omit it from both. For example: A Optionally regenerate ui/src/types/api/catalog.gen.ts with the existing EvidenceThe catalog spec adds the field on requests and responses. The checked-in TypeScript schema omits it from both. Compiling an object literal produced TS2353, and reading the response property produced TS2339. The UI package defines the generator for this exact spec and output path. How it was checkedReproduced: head: with the fix: Checked by 2 independent checks, which split: CONTESTED, DISPROVED Could the catalog types be regenerated alongside the API models? |
||
| $ref: '#/components/schemas/GcpServiceAccountKeyRequest' | ||
| purpose: | ||
| $ref: "#/components/schemas/CredentialPurpose" | ||
| UpdateCredentialRequest: | ||
|
|
@@ -3192,6 +3206,47 @@ components: | |
| '_' and '-'. If not set, the region of the S3-compatible storage holding the requested | ||
| path is used. | ||
| type: string | ||
| GcpServiceAccountEmail: | ||
| description: The email of the Google Cloud service account. | ||
| type: string | ||
|
timothyw553 marked this conversation as resolved.
Resolved
|
||
| maxLength: 1024 | ||
| GcpPrivateKeyId: | ||
| description: The ID of the service account key. | ||
| type: string | ||
| maxLength: 1024 | ||
| GcpServiceAccountKeyRequest: | ||
| description: | | ||
| A key of a Google Cloud service account with access to Google Cloud Storage. Set `email` | ||
| from the key file's `client_email`, and copy `private_key_id` and `private_key`. Its | ||
| locations must be `gs://` paths. The server stores `private_key` encrypted with | ||
| `server.credential-encryption-key`, so it cannot create one without that key. It checks the | ||
| fields and that the private key parses, not that Google accepts the key. | ||
| type: object | ||
| required: | ||
| - private_key_id | ||
| - private_key | ||
| properties: | ||
| email: | ||
| $ref: "#/components/schemas/GcpServiceAccountEmail" | ||
| private_key_id: | ||
| $ref: "#/components/schemas/GcpPrivateKeyId" | ||
| private_key: | ||
| description: The PEM-encoded PKCS#8 private key of the service account key. Write-only; never returned. | ||
|
timothyw553 marked this conversation as resolved.
Resolved
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (not a blocker): A correctly encoded non-RSA key gets an encoding error The API calls for PKCS#8 PEM, while the parser specifically expects RSA. The schema also marks For example: The pinned parser rejects a generated EC key encoded as PKCS#8 PEM. UC then says it Specify a PEM-encoded PKCS#8 RSA private key, describe both identifiers as nonblank, regenerate the model docs and align the invalid-key diagnostic. EvidenceI checked the create-operation description, GCP component schemas and generated model page. They describe required strings and a PEM-encoded PKCS#8 key. The DAO also rejects whitespace-only identifiers and uses an RSA-specific parser. With a generated EC key in PKCS#8 PEM, the pinned parser threw IOException, which the DAO translates into a claim that the encoding is wrong. How it was checkedReproduced: head: Checked by 1 independent check: CONFIRMED References:
Could we name RSA in the field description and error, and make the nonblank identifier requirement explicit? |
||
| type: string | ||
| maxLength: 4096 | ||
| writeOnly: true | ||
| GcpServiceAccountKeyResponse: | ||
| description: The service account key of a `gcp_service_account_key` credential, without its write-only `private_key`. | ||
| type: object | ||
| required: | ||
| - private_key_id | ||
| properties: | ||
| email: | ||
| $ref: "#/components/schemas/GcpServiceAccountEmail" | ||
| private_key_id: | ||
| $ref: "#/components/schemas/GcpPrivateKeyId" | ||
| ListCredentialsResponse: | ||
| type: object | ||
| properties: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit (not a blocker): Without a gate, a release containing only this layer offers a GCP credential that cannot serve data
s3_compatibleis marked EXPERIMENTAL and gated byserver.s3-compatible-storage.enabled.gcp_service_account_keyis available on every server, but in this layer vending under its locations returnsUNIMPLEMENTED.The repository guide says an API addition is hard to remove once added.
For example: If this PR is released before
[Server] Vend GCS credentials from storage credentials(#2273), admins can create credentials and bindgs://locations that every read fails on. The request fields and the stored blob layout also become a compatibility surface before vending has used them.Evidence
The spec says the new type is only stored and that vending fails UNIMPLEMENTED. s3_compatible, right after it, is EXPERIMENTAL and gated by a server property. I found no gate for GCP in CredentialRepository (lines 68 and 163 check only s3_compatible). AGENTS.md says additions are hard to remove.
How it was checked
Checked by 1 independent check: NITPICK
Is the plan to merge this together with #2273 in the same release, or would an EXPERIMENTAL note or a gate be worth adding until then?