Home session expiry maps 401 by exact error-string match (Low)

Abierto
#537 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@irzhywau ya está trabajando en esto.

Desde el 5/11/2026.

  • #539 de @irzhywau — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
56/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start with home_projection_token_error in elastos/crates/elastos-server/src/api/gateway_home_runtime.rs, then read grant_bound_token_expiry in gateway_home_token.rs and RoomSessionAuthorization::validate in room_service.rs. Replace the exact message comparison with typed error handling, and log the underlying grant-store error before it is collapsed. Done when inactive or revoked grants map to 401 regardless of message wording and the underlying error is logged.

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

Descripción

security

Severity: Low (fails closed; correctness and observability only)

Found in the security review of #536.

Current behavior

home_projection_token_error (elastos/crates/elastos-server/src/api/gateway_home_runtime.rs) decides 401 by exact string equality:

if err.to_string() == "home launch token auth session is not active" { 401 } else { 500 }

A future rewording of load_active_session_grant, an added .context(...), or any anyhow display change falls through to gateway_internal_error → 500. Access is still denied, but the client loses its "re-authenticate" signal and logs fill with misleading 500s.

Fix

  • Use a typed error (an enum such as HomeTokenError::SessionInactive, or err.downcast_ref) instead of string equality.
  • Log the underlying error before the map_err(|_| …) collapses in grant_bound_token_expiry (gateway_home_token.rs) and RoomSessionAuthorization::validate (room_service.rs), so a lapsed grant is distinguishable from I/O or state corruption.

Done means

  • A lapsed or revoked grant maps to 401 regardless of how the grant loader's message is worded.
  • The underlying grant-store error is logged before it is collapsed to an auth failure.
Lenguaje dominante
Rust
Estrellas
6
Forks
2
Merge medio
1 d 3 h
PR fusionados (30 d)
42

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 elastos/elastos-runtime

Todos los issues de elastos/elastos-runtime

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.