Encryption key length check refuses 24-byte keys and accepts 64-byte keys
メンテナーはふだん 10 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
長さのチェックは 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
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dgraph-io/dgraph のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
メンテナーはふだん 10 日以内に返信
-
Stale
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
dgraph-io/dgraph#9811 · コメント 1 件 ·
メンテナーはふだん 10 日以内に返信
-
Stale
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dgraph-io/dgraph#9810 · コメント 1 件 ·
メンテナーはふだん 10 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 10 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 10 日以内に返信
dgraph-io/dgraph の issue をすべて見る
似ている issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
DaoCloud/DaoCloud-docs#7839 ·
メンテナーはふだん 1 日以内に返信
-
Type: Enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
projectdiscovery/urlfinder#167 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloverworks-hq/rumpty-cli#95 ·
メンテナーはふだん 1 日以内に返信