close
Skip to content

Gcs csek support#29207

Open
kaveti wants to merge 2 commits intotrinodb:masterfrom
kaveti:gcs-csek-support
Open

Gcs csek support#29207
kaveti wants to merge 2 commits intotrinodb:masterfrom
kaveti:gcs-csek-support

Conversation

@kaveti
Copy link
Copy Markdown
Contributor

@kaveti kaveti commented Apr 22, 2026

raised this pr from review comment from
here: #28793 (comment)

Description

Add support for customer-supplied encryption keys (CSEK) to the GCS filesystem, mirroring the existing S3 SSE-C feature in Trino.

Configuration

Two new configuration properties are added to GcsFileSystemConfig:

  • gcs.encryption-key — Base64-encoded AES-256 key used to encrypt objects written to Google Cloud Storage.
  • gcs.decryption-key — Base64-encoded AES-256 key used to decrypt objects read from Google Cloud Storage. Typically set to the same value as gcs.encryption-key, except during key rotation.

Separate encryption and decryption properties allow key rotation without rewriting all existing data: operators can configure a new encryption key while keeping the old key as the decryption key until all objects are re-encrypted.

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

kaveti added 2 commits April 25, 2026 15:12
Previously, invoking newEncryptedInputFile, newEncryptedOutputFile, or
encryptedPreSignedUri on CacheFileSystem threw UnsupportedOperationException
from the default TrinoFileSystem interface methods. This prevented backing
filesystems that support server-side encryption (e.g. S3 SSE-C, GCS CSEK)
from being served through the coordinator file cache.

Add overrides that forward the encrypted operations to the underlying
filesystem and expire cached entries on writes, mirroring the behavior of
the existing unencrypted overrides.

Extract the AES-256 construction from randomAes256 into a private
ofAes256(byte[]) helper so the "AES256" algorithm string is declared
only once.
Google Cloud Storage supports customer-supplied encryption keys (CSEK),
which allow users to provide their own AES-256 keys to encrypt objects at
rest. This matches the existing S3 SSE-C feature in Trino.

Add two new configuration properties to GcsFileSystemConfig:
- gcs.encryption-key: Base64-encoded AES-256 key used to encrypt objects
  written to Google Cloud Storage.
- gcs.decryption-key: Base64-encoded AES-256 key used to decrypt objects
  read from Google Cloud Storage. Typically set to the same value as the
  encryption key, except during key rotation.

Separate encryption and decryption properties allow key rotation without
rewriting all existing data: configure a new encryption key while keeping
the old decryption key until all objects are re-encrypted.

Additionally, expose internal extra-credential property names
(internal$gcs_encryption_key / internal$gcs_decryption_key) so callers
such as the Iceberg REST catalog can override the configured keys on a
per-identity basis.

Promote EncryptionKey.ofAes256(byte[]) to public visibility so
GcsFileSystemFactory can construct keys from caller-supplied Base64
values without duplicating the algorithm string.
@kaveti kaveti force-pushed the gcs-csek-support branch from d247abe to 8884ee9 Compare April 25, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant