You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vibed/pages/.beans/pages-u3zc--support-tarxz-u...

21 lines
1.3 KiB
Markdown

---
# pages-u3zc
title: Support .tar.xz uploads (xz/LZMA2)
status: completed
type: task
priority: normal
created_at: 2026-07-21T04:15:18Z
updated_at: 2026-07-21T04:33:38Z
parent: pages-w7ow
---
Wire xz-compressed tar archives through the dispatch foundation.
- Crate: `lzma-rs = \"0.3\"` in `[dependencies]` (pure-Rust xz/lzma2 decoder; wasm-safe).
- lzma-rs is ONE-SHOT: `xz_decompress<R: BufRead, W: Write>(&mut input, &mut output)`. Decompress into a `LimitedWriter` bounded by `max_uncompressed_total` so an xz bomb aborts mid-decompress and never fully materializes. Then feed the bounded buffer to `build_tar_manifest`.
- Detect via xz magic `fd 37 7a 58 5a 00`.
- Tests: happy path, missing index.html, path traversal, size limits, and an xz bomb rejected by the LimitedWriter bound (a small .xz whose decompressed tar exceeds max_uncompressed_total must be rejected before full materialization). Note xz has the largest wasm code-size/CPU cost of the three.
## Summary of Changes
xz via `lzma-rs` 0.3 (one-shot). Decompresses into a LimitedWriter bounded by xz_materialize_cap (= max_uncompressed_total + bounded tar framing) so an xz bomb aborts mid-decompress; bounded buffer then tar-parsed. Fixtures via lzma-rs xz_compress. Tests: happy, missing index, traversal, limits, LimitedWriter bomb rejection.