Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

mcf: `PasswordHash::push_base64` with empty input produces an invalid hash

Abierto
#2,471 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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:

  1. Make push_base64 return Result<()> and reject empty input, like push_str (breaking).
  2. Add a fallible try_push_base64 and document that push_base64 requires non-empty input.
  3. 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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RustCrypto/formats

Todos los issues de RustCrypto/formats

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.