mcf: `PasswordHash::push_base64` with empty input produces an invalid hash
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- cryptography
調査の方向性
Start at mcf::PasswordHash::push_base64 and compare its empty-input behavior with push_str and push_displayable. Reproduce the empty-salt path described through pbkdf2 0.13, then determine which API behavior preserves valid MCF strings and add coverage showing that empty input cannot produce an unparsable PasswordHash.
索引モデルが issue の本文から書いたものです。
説明
mcf::PasswordHash is documented as a valid MCF string, and PasswordHashRef::new_unchecked relies on that. push_base64 is infallible, though, and with an empty slice it appends a bare $:
let mut h = mcf::PasswordHash::from_id("6").unwrap();
h.push_base64(b"", mcf::Base64::Crypt);
assert_eq!(h.as_str(), "$6$");
mcf::PasswordHash::new(h.as_str()); // Err(DelimiterInvalid)
h.push_str("tail").unwrap(); // "$6$$tail"
mcf::PasswordHash::new(h.as_str()); // Err(FieldInvalid)
h.fields().collect::<Vec<_>>(); // ["", "tail"]: an empty Field, which Field::new rejects
The other push methods already reject this: push_str("") and push_displayable("") return Err(FieldInvalid).
A real path to it: pbkdf2 0.13's MCF hasher calls push_base64(salt, ...). hash_password_customized with an empty salt then returns a PasswordHash that can't be stored and parsed back.
Possible fixes, which change the API differently, so I'm asking rather than sending a PR:
- Make
push_base64returnResult<()>and reject empty input, likepush_str(breaking). - Add a fallible
try_push_base64and document thatpush_base64requires non-empty input. - Panic on empty input, so the invariant can't be broken silently.
Happy to send a PR for whichever you prefer.
This issue was produced by AI agents (Claude) and reviewed by me before submission.
- 主要言語
- Rust
- スター
- 341
- フォーク
- 193
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 21
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RustCrypto/formats のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
RustCrypto/formats#2482 ·
メンテナーはふだん 1 日以内に返信
-
IssuingDistributionPoint has the wrong AssociatedOid (id-pe-subjectInfoAccess)対応中かも @eyusd が 74 日前に担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
RustCrypto/formats#2389 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
RustCrypto/formats#2366 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
RustCrypto/formats#2430 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
RustCrypto/formats#2428 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
RustCrypto/formats の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
good first issue gpu serve
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
biomejs/biome#12475 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
documentation E-easy good first issue help wanted
難易度 1/5 1〜3時間 初心者へのやさしさ 91/100
メンテナーはふだん 1 日以内に返信