Skip to content

API: Define RotateEncryptionKeys action interface - #18440

Open
dramaticlly wants to merge 3 commits into
apache:mainfrom
dramaticlly:api-rewrap-encryption-keys
Open

dramaticlly wants to merge 3 commits into
apache:mainfrom
dramaticlly:api-rewrap-encryption-keys

Conversation

@dramaticlly

@dramaticlly dramaticlly commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First step of #18240 to define action interface to allow rewrap of encrypted iceberg table.

Added configurable depth level to control how deep the encryption key of iceberg metadata shall be regenerated.

  • KEK: where key-encryption-key is regenerated and stored in table metadata, manifest-list key is unwrapped with old KEK and rewrapped with new KEK. This can be done in table API with only change to metadata.json
  • SNAPSHOT_KEY: where key-encryption-key, manifest-list key are regenerated, existing manifests key in manifest-list are rewrapped. This generates a new snapshot and a new metadata.json, all existing manifests are carried over.
  • MANIFEST_KEY: where key-encryption-key, manifest-list key as well as manifest keys are all regenerated, every data and delete live entry in manifests are rewrapped. All metadata layer keys are replaced. Requires engine to distribute the work and expect a new set of manifests, a new snapshot and new metadata.json

Thought about the option to introduce a new flag on the existing RewriteManifests action and procedure and it was discarded to avoid combining security operation inside a re-clustering/optimizing call, also rewrite manifests can only focused on single partition spec.

Re-wrapping every key in a table means rewriting every manifest, which
is cost prohibitive for large iceberg tables. The level
names the lowest key to regenerate: the keys above it are regenerated
too, the keys directly below it are re-wrapped under the new ones, and
the keys further below are left unchanged.

Generated-by: Claude Code
@dramaticlly

Copy link
Copy Markdown
Contributor Author

@ggershinsky do you think if it's ok to start with KEY_ENCRYPTION_KEY and MANIFEST_KEY depth level? We can always add data file key later in the enum if there's need for the expensive key replacement.

@ggershinsky

Copy link
Copy Markdown
Contributor

sure, makes sense

@ggershinsky

ggershinsky commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

there should also be a MANIFEST_LIST_KEY level, between these two?
KeyRegenerationLevel : KEY_ENCRYPTION_KEY, MANIFEST_LIST_KEY, MANIFEST_KEY, DATA_KEY
(ROOT_MANIFEST for v4?)

@ggershinsky

Copy link
Copy Markdown
Contributor

Thinking of this, we might want to refocus / rename the action, from rewrap to rotate, for the following reasons:

  • KeyRegeneration is basically key rotation
  • "key rotation" is more intuitive and better known than "key rewrapping"
  • data file reencryption does not map well to a key rewrapping hierarchy

Also add SNAPSHOT_KEY level to the enum
@dramaticlly dramaticlly changed the title API: Define RewrapEncryptionKeys action interface API: Define RotateEncryptionKeys action interface Oct 15, 2026
@dramaticlly

Copy link
Copy Markdown
Contributor Author

Thanks @ggershinsky! I added the SNAPSHOT_KEY as new enum to represent both manifest-list in v1-3 and root manifest in v4 and renamed to RotateEncryptionKeys as suggested. I think it make more sense now: for hierarchical iceberg metadata, each encryption key stored one level above what it encrypts. So regenerate of the key at level X apply to all keys traversed from root to X, the file at level X is replaced with a regenerated key but its content is unchanged (rewrap)

@ggershinsky

Copy link
Copy Markdown
Contributor

Yep, I think SNAPSHOT_KEY is a better name

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants