evidencectl dev: reading a state file refuses a valid file renamed over between lookup and open

Abierto
#2,633 1 comentario 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
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
backend, security

Línea de trabajo

Read crates/registry-evidencectl/src/dev.rs and safe_path.rs for the RACE_HOOK pattern. Update read_owner_file so the opened descriptor’s metadata is checked directly, then add a deterministic race test that renames a successor over the path after open. Verify the valid replacement is accepted while a hard link or mode change after open is refused.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area:evidence bug rust

What happens

read_owner_file in crates/registry-evidencectl/src/dev.rs looks the state file up by path, then opens it with O_NOFOLLOW, then refuses the read if the opened inode differs from the one it looked up ("owner-only state changed while opening"). State files are replaced by rename. A replacement that lands between the lookup and the open gives a different, perfectly valid inode, so a concurrent evidencectl dev command can refuse a good state file.

bregctl and caseworkctl had the same false refusal and are fixed on the external record projections branch (feat/breg-external-views): the path checks stay before the open, and after the open the descriptor's own fstat is checked (owner, mode, regular file, link count 0 or 1) instead of comparing with a second lookup. O_NOFOLLOW plus the descriptor's fstat describes exactly the inode whose bytes are read, so the invariant holds without the comparison.

Suggested fix

Apply the same change to read_owner_file, with the same deterministic test (a test-only hook after the open that renames a successor over the path, as in safe_path.rs's RACE_HOOK). A hard link or a mode change after the open must still be refused.

Found while verifying the external record projections branch (feat/breg-external-views).

Lenguaje dominante
Rust
Estrellas
2
Forks
0
Merge medio
9 h 48 min
PR fusionados (30 d)
151

Preparar el entorno

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 registrystack/registry-stack

Todos los issues de registrystack/registry-stack

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.