Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tables

Aperta Adatta ai principianti
#18,632 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@yusufyildiz34 ci sta già lavorando.

Dal 25/10/2026.

  • #18647 di @yusufyildiz34 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend, databases

Direzione di ricerca

Leggi core/src/main/java/org/apache/iceberg/TableMetadata.java, soprattutto TableMetadata.Builder.addEncryptionKey e i controlli di versione vicini citati nell’issue. Aggiungi un controllo della versione del formato v3 che rifiuti l’aggiunta di chiavi di crittografia al di sotto di v3, poi esamina i test esistenti per gli aggiornamenti del builder di TableMetadata e aggiungi casi per il rifiuto in v1/v2 e l’accettazione in v3. Il lavoro è completato quando il builder applica la regola sulla versione, mentre la rimozione e il parsing restano permissivi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Apache Iceberg version

main (development)

Query engine

Other

Please describe the bug 🐞

encryption-keys is v3-only, but TableMetadata.Builder.addEncryptionKey doesn't check the format version. REST servers built on CatalogHandlers accept add-encryption-key from any client and write it into v1/v2 metadata.

Proposed fix

Reject in TableMetadata.Builder.addEncryptionKey below v3. This covers Java clients and REST servers, since both go through the builder. removeEncryptionKey and parsing should stay lenient so existing tables can be cleaned up.

Repro (REST fixture)
docker run -d --rm -p 8181:8181 apache/iceberg-rest-fixture
H='Content-Type: application/json'; U=localhost:8181/v1
curl -s -XPOST $U/namespaces -H "$H" -d '{"namespace":["ns"]}'
curl -s -XPOST $U/namespaces/ns/tables -H "$H" -d '{"name":"t","schema":{"type":"struct","fields":[{"id":1,"name":"id","type":"long","required":false}]},"properties":{"format-version":"2"}}'
curl -s -XPOST $U/namespaces/ns/tables/t -H "$H" -d '{"requirements":[],"updates":[{"action":"add-encryption-key","encryption-key":{"key-id":"kek","encrypted-key-metadata":"a2V5"}}]}'
# 200, "format-version": 2 with "encryption-keys"
Existing version checks in TableMetadata.Builder
More context

Java's own writers don't check the version either (manifest list encryption), they rely on encryption.key-id being rejected on v1/v2 at create (#14668).

Other implementations:

  • iceberg-go: rejects
  • PyIceberg: rejects (apache/iceberg-python#4148)

Related:

  • #18646: other format version checks missing in TableMetadata.Builder
  • apache/iceberg-python#4156: same rules for PyIceberg
  • #14403 / #14668: encryption properties on v1/v2, create only
  • #17728: client-side format version checks on create
  • #16353: encryption key cleanup in TableMetadata
Willingness to contribute
  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
Lingua principale
Java
Stelle
9.4k
Fork
3.6k
Merge medio
3g 17h
PR unite (30g)
143

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/iceberg

Tutte le issue di apache/iceberg

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.