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

Đang mở
#537 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@irzhywau đang làm issue này rồi.

Từ ngày 5/11/2026.

  • #539 của @irzhywau — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
56/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Rust
Star
6
Fork
2
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
42

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của elastos/elastos-runtime

Tất cả issue của elastos/elastos-runtime

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.