Skip to content

feat(encryption) [12/N] write encrypted manifest list#2677

Open
aarushigupta132 wants to merge 8 commits into
apache:mainfrom
aarushigupta132:feat/encrypted-manifest-list-write
Open

feat(encryption) [12/N] write encrypted manifest list#2677
aarushigupta132 wants to merge 8 commits into
apache:mainfrom
aarushigupta132:feat/encrypted-manifest-list-write

Conversation

@aarushigupta132

@aarushigupta132 aarushigupta132 commented Jun 19, 2026

Copy link
Copy Markdown

Which issue does this PR close?

What changes are included in this PR?

Adds encrypted manifest-list writing and wires it into SnapshotProducer::commit. When the table has an EncryptionManager, the manifest list is encrypted, its key is KEK-wrapped, the wrapped key id is stored on the snapshot.

Are these changes tested?

Encrypted round-trip unit test on the manifest-list writer

@aarushigupta132 aarushigupta132 marked this pull request as ready for review June 19, 2026 19:14

/// Construct a v3 [`ManifestListWriter`] that writes to an [`EncryptedOutputFile`].
/// See [`Self::v1_from_encrypted`] for the key-metadata contract.
pub async fn v3_from_encrypted(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we need these new constructors, manifest list writer was refactored to take a FileWrite so we can just construct with the correct encrypting file writer

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the review 🙏 , i have addressed this in the latest commit

@aarushigupta132 aarushigupta132 force-pushed the feat/encrypted-manifest-list-write branch from 38ef25d to 1f644ce Compare July 13, 2026 14:19
@aarushigupta132 aarushigupta132 force-pushed the feat/encrypted-manifest-list-write branch from 09df745 to 19fc82d Compare July 14, 2026 10:24
.new_output(manifest_list_path.clone())?;

let (writer, encrypted) = if let Some(em) = self.table.encryption_manager() {
let enc = em.encrypt(raw_output);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let enc = em.encrypt(raw_output);
let encrypted_output = em.encrypt(raw_output);

Comment on lines +493 to +511
let encryption_key_id = match encrypted {
Some((em, enc)) => {
let key_id = em
.encrypt_manifest_list_key_metadata(enc.key_metadata())
.await?;

updates.extend(em.with_encryption_keys(|keys| {
keys.values()
.filter(|k| self.table.metadata().encryption_key(k.key_id()).is_none())
.map(|k| TableUpdate::AddEncryptionKey {
encryption_key: k.clone(),
})
.collect::<Vec<_>>()
}));

Some(key_id)
}
None => None,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving this to a function and unit testing it.


let (writer, encrypted) = if let Some(em) = self.table.encryption_manager() {
let enc = em.encrypt(raw_output);
(enc.writer().await?, Some((em, enc)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than returning a tuple of tuples, can we just return the key metadata and the writer?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed 🙏 , addressed

@aarushigupta132 aarushigupta132 force-pushed the feat/encrypted-manifest-list-write branch from 3627509 to c7ecd37 Compare July 14, 2026 13:54
@aarushigupta132 aarushigupta132 force-pushed the feat/encrypted-manifest-list-write branch from c7ecd37 to 4b67ed5 Compare July 14, 2026 14:00

@xanderbailey xanderbailey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good to me, requested a test

}

/// Finished building the action and return the [`ActionCommit`] to the transaction.
pub(crate) async fn commit<OP: SnapshotProduceOperation, MP: ManifestProcess>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a commit test to show that we add the correct updates?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants