milestones::set_treasury has no test proving it requires the admin's authorization

Abierto
#556 4 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@sladeoj ya está trabajando en esto.

Desde el 21/10/2026.

  • #582 de @urielit1313-creator — abierto
  • #757 de @sladeoj — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
rust

Línea de trabajo

Read contracts/milestones/src/test.rs and inspect the existing set_treasury tests and authorization mocks. Add a positive test mocking only the admin and a negative test using another address, then run the milestones contract tests and verify the unauthorized call fails with the host auth error. A linked open pull request (#582) indicates this work may already be underway.

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

Descripción

security Stellar Wave testing

Problem

Every milestones test that calls set_treasury runs under env.mock_all_auths(), which authorises every address. No test uses targeted env.mock_auths(&[MockAuth { address: <admin>, invoke: … fn_name: "set_treasury" … }]) or checks that a call signed by a different address fails. (In contracts/milestones/src/test.rs, targeted mocks exist only for no function at all.) If the require_auth() call were deleted or pointed at the wrong address, the suite would still pass. Escrow's equivalent test exists (though it currently fails, see the separate issue).

Suggested fix

Add a positive test that mocks only the admin's auth for set_treasury, and a negative test that mocks another address's auth and asserts the host auth error.

Related: #50

Lenguaje dominante
Rust
Estrellas
1
Forks
102
Merge medio
4 h 12 min
PR fusionados (30 d)
30

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

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 MergeFi/contracts

Todos los issues de MergeFi/contracts

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.