GeezerVison is showing github.com — fix(client-runtime): enforce the ZIP XML size limit case-insensitively by saphid · Pull Request #44492 · pingdotgg/t3code
Conversation
Problem
ZIP entries with uppercase or mixed-case .XML extensions (such as word/document.XML, word/Styles.Xml, ppt/slides/slide1.XML, or content.XML) bypass the 8 MiB xmlLimit guard across all four ZIP/Office archive readers (boundedZip.ts, encryptedZip.ts, officeArchive.ts, and openDocumentEncryption.ts) because each checked .endsWith(".xml") case-sensitively.
Deterministic repro on origin/main (68a67a0f20f5c768e229dbde26f4784d7d64e8b8):
Run from packages/client-runtime:
node --input-type=module -e '
import JSZip from "jszip";
import { boundedZip } from "./src/zip/boundedZip.ts";
const buf = await new JSZip().file("word/document.XML", "x".repeat(200)).generateAsync({ type: "arraybuffer", compression: "STORE" });
console.log((await boundedZip(buf, 1000, { xmlLimit: 100 })).get("word/document.XML")?.bytes.byteLength);
'
- Observed on
origin/main: boundedZip succeeds and returns the 200-byte word/document.XML entry despite xmlLimit: 100 (same for password-protected ZIPs via readEncryptedZip), while lowercase word/document.xml rejects with ZipError({ code: "archive-expanded-too-large" }). Similarly, prepareOffice(bytes, "pptx") and unlockOpenDocument(zip, "open me") bypass their 8 MiB .xml guards for uppercase .XML entries.
- Expected: All four ZIP/Office readers reject uppercase and mixed-case
.XML entries with their expanded-size error (archive-expanded-too-large / office-too-large-expanded) whenever expanded size exceeds the XML limit, while still allowing non-XML entries up to entryLimit.
Change
Lowercase the entry name/path before checking .endsWith(".xml") in all four archive readers:
packages/client-runtime/src/zip/boundedZip.ts (computed once per entry outside the streaming data handler) and packages/client-runtime/src/zip/encryptedZip.ts — shared by web, desktop, and mobile ZIP previews.
apps/web/src/components/files/officeArchive.ts (computed once per entry outside the streaming data handler) and apps/web/src/components/files/openDocumentEncryption.ts — web/desktop Office preview and encrypted OpenDocument decryption paths.
Added focused regression tests in packages/client-runtime/src/zip/boundedZip.test.ts and apps/web/src/components/files/officeArchive.test.ts covering all four paths.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
- Base (
68a67a0f20f5c768e229dbde26f4784d7d64e8b8) regression tests:
boundedZip.test.ts: failed as expected (AssertionError: promise resolved "Map{ 'word/' => { …(3) }, …(1) }" instead of rejecting).
officeArchive.test.ts: both new cases failed as expected (prepareOffice bypassed the 8 MiB XML guard and hit office-not-open-xml; unlockOpenDocument bypassed the 8 MiB XML guard and hit office-invalid).
- Head (
16566bf1de7fe8e52d87f0aac0f61843cbee8a85) regression tests (3 consecutive runs): vp test run packages/client-runtime/src/zip/boundedZip.test.ts apps/web/src/components/files/officeArchive.test.ts passed 24/24 tests across 2 files three consecutive times.
- Changed checks:
vp run check:changed exited 0 (format, lint, knip 1/2 & 2/2, typecheck across 7 packages, affected unit tests, and React compiler coverage).
- Before/after runtime & test transcript: https://gist.github.com/saphid/8959f8220023e39dcadeae4d87d189cc
- Not shown: Interactive browser/mobile UI walkthrough (no UI/copy/layout changes; all affected archive readers are verified at the unit and runtime layers) and full repo-wide test suite (delegated to CI).
Authored by Gemini 4 Neon (Antigravity); reviewed by Kimi K3.1 Pro (Model Hub).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
ZIP and Office archive size checks now recognize .xml extensions regardless of letter case. Tests cover oversized uppercase XML entries in unencrypted and encrypted archives, including OpenDocument manifests.
Changes: XML archive size limits
| Layer / File(s) |
Summary |
Client-runtime ZIP limits packages/client-runtime/src/zip/boundedZip.ts, packages/client-runtime/src/zip/encryptedZip.ts, packages/client-runtime/src/zip/boundedZip.test.ts |
ZIP readers apply the XML size limit to uppercase and mixed-case extensions. Tests cover oversized uppercase XML entries in unencrypted and encrypted ZIPs. |
Office archive limits apps/web/src/components/files/officeArchive.ts, apps/web/src/components/files/openDocumentEncryption.ts, apps/web/src/components/files/officeArchive.test.ts |
Office archive and OpenDocument checks apply their XML size limits regardless of extension case. Tests cover oversized uppercase .XML entries. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: yash-singh1
Merge Risk: Minimal · up to 95713
-
This change applies the XML expanded-size limit to uppercase and mixed-case .xml extensions in ZIP and Office archive readers. It is small, covered by regression tests, and shows no remaining merge risk.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the actual change: the ZIP XML size limit is now enforced case-insensitively in the client-runtime ZIP reader. The changeset also touches the web Office and OpenDocument readers, which… |
| Description check |
 |
The description follows the template. It has Problem, Change, Scope, and Verification sections with concrete content. The Problem section gives a reproduction and expected behavior. The Change section… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the actual change: the ZIP XML size limit is now enforced case-insensitively in the client-runtime ZIP reader. The changeset also touches the web Office and OpenDocument readers, which the title does not mention, but the title still matches the main fix and follows the conventional commit format.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections with concrete content. The Problem section gives a reproduction and expected behavior. The Change section lists each of the four readers and explains why. Scope explains why no issue is linked. Verification gives base and head test results, the check run, and a transcript link, and it states what was not checked. The template's optional agent-model line is present. The description is detailed and mostly complete.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 407661c and 9571302.
Files selected for processing: 1
-
packages/client-runtime/src/zip/boundedZip.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Opened five STORE ZIPs containing identical 9 MiB XML entries through Files, unlocking encrypted copies with open me. Real web client, fresh state on each commit, light theme, 1440×1080 viewport. Base opens uppercase/mixed-case XML; head rejects every case with the expanded-archive limit error. Lowercase controls remain rejected.
Scenario file · Fixture generator
scenarios:prove exited 0: fails on base and passes on head.
Not shown:
- Office archive and encrypted OpenDocument manifest readers were not exercised; this reproduction uses the ZIP preview paths.
- Non-XML entry, total-size, and compression-ratio limits were not separately exercised; the fixtures isolate XML suffix case handling.
- Desktop and mobile clients were not exercised; proof covers the web client.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|