Encryption key length check refuses 24-byte keys and accepts 64-byte keys

Aperta Adatta ai principianti
#9,898 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
security

Direzione di ricerca

Il controllo della lunghezza si trova in x/acl_enc_keys.go dentro GetEncAclKeys, intorno alla riga 55, e le stesse tre lunghezze compaiono nel testo di aiuto di registerEncFlag e nel messaggio di errore. Inizia leggendo quel controllo e verifica che rifiuti le chiavi da 24 byte e accetti quelle da 64. È completato quando il controllo e il testo dell'errore accettano e indicano esattamente 16, 24 o 32 byte, con un test che verifichi che una chiave da 24 byte venga accettata e una da 64 byte venga rifiutata.

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

Descrizione

Summary

x.GetEncAclKeys (x/acl_enc_keys.go) accepts an --encryption key-file key of 16, 32 or 64 bytes and refuses
any other length. The --encryption help text (same file, registerEncFlag) and the documentation
(https://docs.dgraph.io/installation/configuration/encryption-at-rest: "The key size must be 16, 24, or 32 bytes")
say 16, 24 or 32. AES and Badger accept 16, 24 or 32. As a result:

  • a 24-byte key (AES-192), which the help text and docs advertise, is refused at start;
  • a 64-byte key passes the check, then the alpha exits when Badger opens its key registry.

Only 16- and 32-byte keys work. Both failures happen at start (they fail closed), so no data is at risk.

Versions

Seen on a build of v25.5.0 plus fork changes that do not touch this code. The same check is on main at
e95fc2652 (2026-11-20): x/acl_enc_keys.go line 55,
if l := len(encKey); encKey != nil && l != 16 && l != 32 && l != 64 {.

Steps to reproduce

head -c 24 /dev/urandom > key24
head -c 64 /dev/urandom > key64
dgraph zero --my=localhost:5080 &
dgraph alpha --my=localhost:7080 --zero=localhost:5080 --encryption "key-file=key24;"
# exits: encryption key must have length of 16, 32, or 64 bytes, got 24 bytes instead
dgraph alpha --my=localhost:7080 --zero=localhost:5080 --encryption "key-file=key64;"
# logs "Encryption feature enabled.", then exits:
# During OpenKeyRegistry err: Encryption key's length should beeither 16, 24, or 32 bytes

Expected

The check accepts exactly the lengths AES accepts and the help text and docs state: 16, 24 or 32 bytes.

Suggested fix

l != 16 && l != 24 && l != 32, and the same three lengths in the error message. The --vault path goes through
the same check, so it is fixed by the same line.

Lingua principale
Go
Stelle
21.8k
Fork
1.6k
Merge medio
11g 7h
PR unite (30g)
5

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 dgraph-io/dgraph

Tutte le issue di dgraph-io/dgraph

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.