mcf: `PasswordHash::push_base64` with empty input produces an invalid hash
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- cryptography
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 341
- Forks
- 193
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 21
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RustCrypto/formats
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
RustCrypto/formats#2482 ·
Los mantenedores suelen responder en 1 día
-
IssuingDistributionPoint has the wrong AssociatedOid (id-pe-subjectInfoAccess)Posiblemente ocupada @eyusd la tomó hace 72 días. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
RustCrypto/formats#2389 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
RustCrypto/formats#2366 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
RustCrypto/formats#2430 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
RustCrypto/formats#2428 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de RustCrypto/formats
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
bherbruck/solvecraft#2167 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
bitcoindevkit/bdk-cli#357 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Wavvon/Wavvon-clients#136 ·
Los mantenedores suelen responder en 1 día
-
GUI:纯报告任务验收后误显示“已合并”Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
vorton-lang/Lobotomy#95 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
AimesSoft/NipaPlay-Reload#1022 ·
Los mantenedores suelen responder en 1 día