Repository navigation
Find zip entries stored with backslash separators in pptx packages - #1406
Conversation
Found while testing crates/pptx/src/opc.rs:77-82 (Package::open_within), lookup in Package::get via norm at :258 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Normalize and test entry lookup crates/pptx/src/opc.rs |
ZIP entry names use norm for separator and case normalization. A test verifies lookup of PPT\Slides\Slide1.xml as ppt/slides/slide1.xml. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers: echelon
Merge Risk: 
Minimal · up to 939bd
-
The PR aligns ZIP entry indexing with lookup normalization and adds focused regression coverage.
Security architecture risk: 
Low · up to 939bd
-
The change is confined to presentation-package lookup and preserves existing decompression and XML-size controls. It also makes slash and backslash variants collide, with the later accepted entry winning. No security-control bypass was established, but the policy for ambiguous packages is not explicitly covered.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — A supplier of an imported archive controls entry names, contents and ordering, and can therefore influence which separator-alias entry is selected within that package. The inspected change adds no new endpoint or authority; its direct effect is package-local content selection through existing import APIs.
Trust Boundaries and Controls
- observed — Existing entry-count, per-part, cumulative-byte and inflate-work controls precede index insertion. Inflated bytes are charged even when discarded, and XML lookup retains its separate size limit. Normalizing the insertion key does not remove these controls.
- observed — Inspected chart-preservation paths retain normalized folder and dot-segment validation, while the writer assigns generated names to preserved parts. Expanded reader matching did not demonstrate a bypass of those output-path controls.
Resilience and Maintainability Implications
- observed — The index is built locally and exposed only on constructor return. Unreadable or oversized entries are skipped, and work-budget exhaustion returns the accepted subset under existing behavior. Replacement occurs only after an entry has passed reading and size checks, so a rejected alias does not overwrite an accepted part.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Review notes (read the diff, ran tests on Linux). Ran The change keys parts by Not checked: whether PowerPoint itself opens a package with backslash entry names (I did not build such a file for PowerPoint), and no real-world file with this problem was available to try. |
|
Checked with real PowerPoint (Microsoft Office 16, on Windows) and a scratch build of What ran:
So on Not checked: the PR's unit test and the app UI. |
Find zip entries stored with backslash separators in pptx packages
|
Landed on main, thank you @Silvertree2010 for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft |
|
Note on what I changed before landing: the stored original name also uses |
Found while testing
crates/pptx/src/opc.rs:77-82 (Package::open_within), lookup in Package::get via norm at :258(no existing issue): Zip entries named with backslash separators are never found when a .pptx is opened.Cause
Package::open_within keyed parts by
name.to_ascii_lowercase(), but Package::get looks them up withnorm(), which also turns\into/. Entries such asppt\slides\slide1.xmlwere stored under the backslash name and could never be found.Fix
Parts are now keyed with
norm(&name), the same function the lookup uses.normalso lowercases ASCII, so case-insensitive lookup still works. The regression testopc::tests::backslash_zip_entry_names_are_founduses the mixed-case backslash entryPPT\Slides\Slide1.xml. It fails without the fix and passes with it.Verified
opc::tests::backslash_zip_entry_names_are_found: fails onmainwithout the fix and passes with it (cargo test -p deckcraft-pptx --lib backslash_zip_entry_names_are_found).cargo xtask cipasses excepttests::east_asian_vertical_text_stands_ideographs_upright, which also fails onmainwithout this change.Not changed
The original entry name is still stored and returned as before. How two entries that normalise to the same key collide is unchanged: the later entry still replaces the earlier one, as it did for case-only collisions. Verify with
cargo test -p deckcraft-pptx --lib backslash_zip_entry_names_are_found.🤖 Generated with AI by ApolloOffice, see the Co-Authored-By trailers for the models
Summary by CodeRabbit