Library: bound memory while creating and downloading archives

Đang mở
#481 3 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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
32/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
Lĩnh vực
backend, security

Hướng nghiên cứu

Start with elastos/crates/elastos-server/src/library.rs at the archive creation points cited in the issue, then trace the response handling in api/gateway_provider_proxy.rs. Reproduce with incompressible input larger than the proposed RAM budget and measure peak RSS and responsiveness on Mac and Linux. Done means archive creation and export meet an enforced budget or stream from bounded staging, with Download and Compress tests covering folders and selections, safe cleanup, archive integrity, full protected input authentication, and a recorded release disposition.

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

Mô tả

User impact

Library builds a folder or selection archive in memory before sending it. A set of individually valid media files can therefore consume memory proportional to the total archive, with further buffers when Compress saves a protected result. The user needs a bounded export that keeps Home responsive and explains a capacity refusal.

Found during the systematic audit in #93. Proposed priority: P2, with an explicit release decision after a bounded-memory reproduction. This is source evidence; peak memory and installed failure threshold remain unmeasured.

Source evidence

Applies to fetched develop 3beb816438fd567145a8d725e22465bd83277cf0 and local candidate 460b1888d344f52cebd1c25866be88ff4085f035.

  • Develop tar.gz creation writes to a growing Vec<u8>; ZIP does the same at line 3920. Candidate equivalents are library.rs:3970 and :3991.
  • Candidate library.rs:4001 returns the entire ZIP buffer. Selection archives use the same approach.
  • api/gateway_provider_proxy.rs:1156-1166 chunks an already complete buffer into the HTTP response. This bounds network chunk size, not archive construction memory.
  • The per-file upload limit does not bound a folder's aggregate size. The train's archive extraction limits protect a different operation.

Acceptance

  • Choose and enforce an archive creation memory/size budget, or stage to an owned bounded file and stream it.
  • Use incompressible input larger than the accepted RAM budget; record peak RSS and Home responsiveness on Mac and Linux.
  • Test Download and Compress for folders and selections.
  • Cancellation and errors clean up only owned partial output; the source files remain intact.
  • Archive integrity and full authentication of protected input are verified.
  • Record the exact candidate and the release disposition.

Related existing work: #445 lists/decrypts files, #450 opens individual protected files, #449 bounds extraction, #444 protects startup/update/recovery from large objects. This issue owns archive creation and export, so it does not duplicate those tasks.

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.