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

オープン 初心者向け
#9,898 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 10 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
security

調査の方向性

長さのチェックは x/acl_enc_keys.go の GetEncAclKeys 内、55行目付近にあります。同じ3つの長さは registerEncFlag のヘルプテキストとエラーメッセージにも現れます。まずそのチェックを読み、24バイトのキーを拒否し、64バイトのキーを受け入れていることを確認してください。チェックとエラーテキストが正確に16、24、32バイトを受け入れ、その旨を示し、24バイトのキーが受け入れられ、64バイトのキーが拒否されることを確かめるテストがあれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
21.8k
フォーク
1.6k
平均マージ
11日 7時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dgraph-io/dgraph のほかの issue

dgraph-io/dgraph の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。