Repository navigation
Route Markdown conversion through ZIP admission - #62
Conversation
markdown::convert opened Office archives with a plain ZipArchive, so a document that intake::extract refuses (a part over 8 MiB, more than 2048 members, an oversized or ambiguous central directory) was read in full. Open them through intake's preflight and admitted reader, and cap each declared part at intake's 8 MiB as well as the 64 MiB aggregate. Encrypted unrelated members stay skipped rather than refused, as before. Closes tinyhumansai#61
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Tiny Sweeper reviewReviewed head: FindingsPreviously reported and still active
Advisory notes
Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): Route Markdown conversion through ZIP admission. This change closes #61 by making `markdown::convert` open Office archives through intake's bounded ZIP admission instead of a plain `ZipArchive::new`, which previously let a document that `intake::extract` refuses be read in full. Word/PowerPoint OOXML readers now open archives via a new `pub(crate)` `admitted_archive` helper that runs intake's `zip_preflight` and admitted reader; each declared part is capped at intake's 8 MiB alongside the existing 64 MiB aggregate cap; XLSX gets the same preflight before calamine opens the bytes with its own reader; and encrypted unrelated members are still skipped rather than refused. There is no public API change and `MAX_DECOMPRESSED_BYTES` is unchanged. Three convert-path tests are added, and the nested-archive guard has been rewritten in this push to use `convert(...).unwrap()` and assert both that the outer text is present and that the nested secret is absent. The critique, commits and description lanes each report one prior finding still open on the nested-archive test. Separately, the latest-push delta is unavailable — the review state lacks a trusted base-to-head diff comparison, so nothing here is presented as a push delta. Review snapshot
Completeness: Complete What changed`markdown::convert` now routes Office archive opening through intake's admission path. In `src/intake/mod.rs`, `MAX_PART` (8 MiB) is widened to `pub(crate)` and a new markdown-gated `pub(crate) fn admitted_archive` runs `zip_admission::zip_preflight` then `zip_admission::open_admitted_zip`, the same sequence `extract` uses. In `src/markdown/ooxml.rs`, `ooxml::open` calls `admitted_archive` rather than `ZipArchive::new`, and its declared-size check is generalized to `declared_sizes`, which returns both the largest and the summed declared uncompressed sizes from the central directory and refuses the archive when the largest exceeds `MAX_PART` or the total exceeds `MAX_DECOMPRESSED_BYTES`. The per-entry streaming cap in `read_parts` moves from `MAX_DECOMPRESSED_BYTES` to `MAX_PART`. `src/markdown/README.md` documents the ordered admission sequence, the 8 MiB per-member cap and the skip-rather-than-refuse handling of encrypted members. Three tests are added to `src/markdown/mod_tests.rs`, including a nested-archive guard that is now written to unwrap the outer conversion and assert both the presence of the outer text and the absence of the nested secret. One prior critique finding on that nested test remains open. Separately: the latest-push delta is unavailable — the review state lacks a trusted base-to-head diff comparison. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. Before merge
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
The test only checked the text when convert succeeded, so an error would have passed silently. Conversion succeeds here (the corrupt record is on a member DOCX never reads), so require that, require the outer text, and refuse the nested text.
Closes #61.
markdown::convertopened Office archives with a plainZipArchive::new, so a document thatintake::extractrefuses was read in full. That covered a part over 8 MiB, more than 2048 members, and an oversized or ambiguous central directory. Archives now open through intake'szip_preflightand admitted reader, the same pathextractuses. Each declared part is capped at intake's 8 MiB, and the 64 MiB aggregate cap stays.Behaviour changes:
convertrefuses archives that intake's admission refuses, and any part declared over 8 MiB.encrypted_unrelated_parts_do_not_hide_valid_slides.Public API: none.
MAX_DECOMPRESSED_BYTESis unchanged.Tests (convert path):
Validation (our Linux CI runner):
cargo test --locked --all-featuresall pass (227 passed, 0 failed), andcargo +1.88 check --locked --all-targets --all-featurespasses.Branch: M3gA-Mind/tinydocs fix/sr001-convert-admission @ 8adfa5c (pushed).