Add bounded streaming multipart staging and upload sinks
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
- 30/100
Hướng nghiên cứu
Bắt đầu với design.md và issue #185 về raw request-body sink, sau đó lần theo các entry point request.body().stage_multipart! và publish! được mô tả ở đây. So sánh contract được đề xuất với các guarantee hiện có của writable-root và CreateNew. Hoàn tất nghĩa là có streaming bị giới hạn, cleanup an toàn, kết quả publication rõ ràng, cùng coverage được liệt kê cho fragmentation, failure, cross-platform và fuzzing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Build the multipart follow-up explicitly deferred by #185.
The host should stream multipart/form-data, capture small declared fields in bounded memory, and stage declared file fields under a writable-root capability. Roc receives metadata and opaque staged-file handles rather than every file byte.
Illustrative shape:
upload = request.body().stage_multipart!({
root: upload_root,
allowed_file_fields: ["avatar", "attachment"],
allowed_value_fields: ["caption"],
limits: {
max_parts: 8,
max_files: 2,
max_file_bytes: 10 * 1024 * 1024,
max_part_header_bytes: 8 * 1024,
max_field_bytes: 16 * 1024,
max_total_field_bytes: 32 * 1024,
},
})?
upload.files.get(0)?.publish!({
relative: destination,
mode: CreateNew,
})?
Exact types should be designed during implementation.
Why this belongs in the host
A streaming boundary parser sits directly between an untrusted HTTP transport and host files. Keeping the transfer in the host preserves backpressure, bounds memory, enables secure staging, and prevents every file byte crossing into Roc.
Unlike arbitrary callbacks, the application supplies a finite declarative plan before the transfer. This follows design.md's request-body sink model.
Required contract
- Require a valid
multipart/form-datacontent type and boundary. - Enforce independent limits for total body bytes, parts, files, per-file bytes, part headers, individual value fields, and aggregate in-memory fields.
- Preserve field order and duplicate names.
- Return text/value fields as bytes unless their character decoding is unambiguous.
- Treat client filenames and claimed content types as untrusted metadata only.
- Never use a client filename as a filesystem path.
- Stage files securely and exclusively on the selected writable root's filesystem.
- Return opaque staged handles whose final release removes unpublished files.
- Publish only to validated relative paths with the existing
CreateNewsemantics. - On malformed input, disconnect, timeout, shutdown, saturation, or limit failure, remove every staged file.
- Do not promise atomic publication across multiple files. Each publication result is explicit.
- Reject nested multipart in the first version.
- Track active multipart sinks, staged files, and high-water resource use.
Staging before publication permits the application to inspect bounded form fields and metadata before selecting final destinations without installing a callback into Roc.
Tests
- Boundary fragments split across every possible transport chunk position.
- Empty, quoted, and maximum-length boundaries.
- Repeated fields and repeated file names.
- Header-count/byte, part-count, file-count, and size limits.
- Malformed closing boundaries and truncated bodies.
- Disconnect, timeout, and shutdown at each stage.
- Cleanup when handles are dropped or publication fails.
- Traversal and client-filename attacks.
- Parser fuzzing and a corpus of real browser multipart bodies.
- Zero leaked files, permits, buffers, or handles.
Non-goals
- MIME-type trust or file-signature validation
- Antivirus, sandboxing, or content disarm
- Arbitrary application callbacks while parsing
- Client-selected filesystem destinations
- Unbounded text-field materialization
- Atomic multi-file transactions
- Background or resumable uploads
Acceptance criteria
- Declared multipart files stream to secure staging without materializing file bodies in Roc.
- Every parser and storage dimension has a finite limit.
- Unpublished handles clean themselves up on all paths.
- Publication reuses writable-root and safe-relative-path guarantees.
- The parser has cross-platform, fragmentation, and fuzz coverage.
References
- Ngôn ngữ chính
- HTML
- Star
- 110
- Fork
- 25
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của roc-lang/basic-webserver
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
roc-lang/basic-webserver#277 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
roc-lang/basic-webserver#274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
roc-lang/basic-webserver#273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
roc-lang/basic-webserver#272 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
roc-lang/basic-webserver#265 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của roc-lang/basic-webserver
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OHDSI/Data2Evidence#3815 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redhat-developer/rhdh-plugin-export-overlays#4995 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fidelity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsCó thể đã có người làm @huanghaoyuanhhy đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zilliztech/milvus-backup#1418 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] download repeatedly fetches unchanged gzip responses due to compressed/decoded size mismatchCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
stanfordnlp/dspy#11000 ·
Maintainer thường phản hồi trong vòng 1 ngày