René's URL Explorer Experiment


Title: fix(file-parsers): guard .doc uploads against zip-bomb memory exhaustion by waleedlatif1 · Pull Request #6166 · simstudioai/sim · GitHub

Open Graph Title: fix(file-parsers): guard .doc uploads against zip-bomb memory exhaustion by waleedlatif1 · Pull Request #6166 · simstudioai/sim

X Title: fix(file-parsers): guard .doc uploads against zip-bomb memory exhaustion by waleedlatif1 · Pull Request #6166 · simstudioai/sim

Description: Summary Closes a zip-bomb memory-exhaustion path on document upload, in two parts. 1. .doc skipped the guard entirely. DocParser handed the raw upload straight to officeparser and then mammoth, without the assertOoxmlArchiveWithinLimits call its docx/pptx/xlsx siblings all make. The extension is only a routing hint — both libraries accept an OOXML container regardless of its name — so a bomb renamed .doc selected the unguarded parser and bypassed the guard that catches the identical bytes as .docx. The guard is now the first act of DocParser.parseBuffer, and is also enforced centrally in lib/file-parsers parseBuffer so a future parser can't silently opt out. 2. The guard itself was bypassable by lying. The declared uncompressed sizes live in the ZIP central directory, which is attacker-controlled. Under-report them and the size and ratio checks pass untouched; officeparser/mammoth only notice the mismatch after inflating each entry in full. Measured on a 498 KB archive declaring 1000 bytes per entry: parser before after .doc +559 MB resident +0 MB, rejected in 2 ms .docx +538 MB resident +0 MB, rejected in 1 ms .xlsx / .pptx +11 / +4 MB (container rejected early) +0 MB Every entry is now inflated during verification under a maxOutputLength bound equal to the size it declared. Node's zlib aborts the moment output would exceed that bound, so a lying entry costs only its declared size and the bytes are discarded immediately. Stored entries are checked against their own compressed size; unsupported compression methods fail closed. Verification walks the contiguous run of central-directory records rather than the EOCD's declared count, since that run is what a decompression library actually allocates per entry — a lied-down count must not hide an entry from verification. No limits changed: this reuses the existing DEFAULT_OOXML_SIZE_LIMITS all four parsers already ship against. Type of Change Bug fix (security — resource exhaustion / DoS) Testing Both bomb variants (honest and under-declared) are now rejected at +0 MB across .doc, .docx, .xlsx, .pptx, and .txt. Verified the new tests go red when the verification pass is disabled (4 fail) and when the .doc guard call is removed (3 fail). No false positives, checked against real files rather than only synthetic ones: 17/17 real Word-produced .docx fixtures from mammoth's test data still accepted txt / md / json / yaml / csv / html, valid OOXML as .docx/.doc/.pptx, and legacy OLE .doc all parse unchanged 0/2000 random buffers rejected; PDF, OLE, and BOM-text magic all pass maxOutputLength boundary confirmed to accept output equal to the cap, so honest archives are never rejected Cost: ~0.45 ms per MB of uncompressed content (1.4 ms @ 1 MB, 5.3 ms @ 10 MB, 22 ms @ 50 MB), against parse times an order of magnitude larger. The declared-size check still runs first, so a straightforward bomb is rejected at zero cost. Gates: tsc clean, check:api-validation passed, biome clean, 61 file-parser tests plus 1495 tests across uploads / knowledge / files API / copilot. (8 lib/copilot/** test files fail to collect on a PostCSS/Tailwind config error — confirmed identical with this branch's changes fully reverted, so pre-existing and unrelated.) Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Closes a zip-bomb memory-exhaustion path on document upload, in two parts. 1. .doc skipped the guard entirely. DocParser handed the raw upload straight to officeparser and then mammoth, wit...

X Description: Summary Closes a zip-bomb memory-exhaustion path on document upload, in two parts. 1. .doc skipped the guard entirely. DocParser handed the raw upload straight to officeparser and then mammoth, wit...

Opengraph URL: https://github.com/simstudioai/sim/pull/6166

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e04b0697-1942-0215-1a9b-fef7cbecb8a5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB6C6:1EE905:506367:7264CF:6AFB405C
html-safe-nonce1b69c08329a7070f9a9f77cd12032f2bf30cec68a99c47f851e0115e628a83d5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkM2OjFFRTkwNTo1MDYzNjc6NzI2NENGOjZBRkI0MDVDIiwidmlzaXRvcl9pZCI6IjQwMDU2NTExMTk1NTA5NzE5OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace0080ee58b2439bc9a3c13a88a89cfe6c82a6cb9eba514fc7954d1a215224bad
hovercard-subject-tagpull_request:4185063307
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6166/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Closes a zip-bomb memory-exhaustion path on document upload, in two parts. 1. .doc skipped the guard entirely. DocParser handed the raw upload straight to officeparser and then mammoth, wit...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea6c2f87cbcb6414452377b4967858ed6a66f1109
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6166/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6166%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6166%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6166/files
Reloadhttps://github.com/simstudioai/sim/pull/6166/files
Reloadhttps://github.com/simstudioai/sim/pull/6166/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests200 (200)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
worktree-fix+doc-parser-zip-guardhttps://github.com/simstudioai/sim/tree/worktree-fix%2Bdoc-parser-zip-guard
Conversation 19 https://github.com/simstudioai/sim/pull/6166
Commits 4 https://github.com/simstudioai/sim/pull/6166/commits
Checks 27 https://github.com/simstudioai/sim/pull/6166/checks
Files changed https://github.com/simstudioai/sim/pull/6166/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6166/files
fix(file-parsers): guard .doc uploads against zip-bomb memory exhaustion https://github.com/simstudioai/sim/pull/6166/files#top
Show all changes 4 commits https://github.com/simstudioai/sim/pull/6166/files
6a006c4 fix(file-parsers): guard .doc uploads against zip-bomb memory exhaustion waleedlatif1 Aug 1, 2026 https://github.com/simstudioai/sim/pull/6166/commits/6a006c466fbd74a60ff965757d2a2a548b1a70c6
07e2eea fix(file-parsers): verify actual inflation, not just declared ZIP sizes waleedlatif1 Aug 1, 2026 https://github.com/simstudioai/sim/pull/6166/commits/07e2eea272b19f5c2a7152db1af38130ddcfdf4b
fac1c7c fix(file-parsers): require central and local ZIP headers to agree waleedlatif1 Aug 1, 2026 https://github.com/simstudioai/sim/pull/6166/commits/fac1c7cda08531db44cc1db2ac3b25b554ab0166
bea4e75 fix(file-parsers): charge hidden central-directory entries against th… waleedlatif1 Aug 1, 2026 https://github.com/simstudioai/sim/pull/6166/commits/bea4e75ecb73000c9bd33bfadc7d3d0b7996b055
Clear filters https://github.com/simstudioai/sim/pull/6166/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6166/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6166/files
doc-parser.test.ts https://github.com/simstudioai/sim/pull/6166/files#diff-636baec61c335570e8c4c131648286c2870368751f2cdf0a73b59d057ccf4a42
doc-parser.ts https://github.com/simstudioai/sim/pull/6166/files#diff-cdfc927b24e9d2666bd93713a077b86bbded2c33e752f1a6f298e0fcf5c48032
index.ts https://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
zip-guard.test.ts https://github.com/simstudioai/sim/pull/6166/files#diff-b8a14e85c6ff70831de6efe4b18e53eb3dd16020b3eed3d7139e6b37fa9a4f51
zip-guard.ts https://github.com/simstudioai/sim/pull/6166/files#diff-82ff22d430d10a3c394c674c4b75b7ba2ce0b74c14e84fdc08ff7b489015b767
apps/sim/lib/file-parsers/doc-parser.test.tshttps://github.com/simstudioai/sim/pull/6166/files#diff-636baec61c335570e8c4c131648286c2870368751f2cdf0a73b59d057ccf4a42
View file https://github.com/simstudioai/sim/blob/bea4e75ecb73000c9bd33bfadc7d3d0b7996b055/apps/sim/lib/file-parsers/doc-parser.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6166/{{ revealButtonHref }}
apps/sim/lib/file-parsers/doc-parser.tshttps://github.com/simstudioai/sim/pull/6166/files#diff-cdfc927b24e9d2666bd93713a077b86bbded2c33e752f1a6f298e0fcf5c48032
View file https://github.com/simstudioai/sim/blob/bea4e75ecb73000c9bd33bfadc7d3d0b7996b055/apps/sim/lib/file-parsers/doc-parser.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6166/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6166/files#diff-cdfc927b24e9d2666bd93713a077b86bbded2c33e752f1a6f298e0fcf5c48032
https://github.com/simstudioai/sim/pull/6166/files#diff-cdfc927b24e9d2666bd93713a077b86bbded2c33e752f1a6f298e0fcf5c48032
https://github.com/simstudioai/sim/pull/6166/files#diff-cdfc927b24e9d2666bd93713a077b86bbded2c33e752f1a6f298e0fcf5c48032
apps/sim/lib/file-parsers/index.tshttps://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
View file https://github.com/simstudioai/sim/blob/bea4e75ecb73000c9bd33bfadc7d3d0b7996b055/apps/sim/lib/file-parsers/index.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6166/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
https://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
https://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
https://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
https://github.com/simstudioai/sim/pull/6166/files#diff-5340b2eaee20e0208a9b187e5946c1b1bf273be94c0e2da72d79adedc2a399f7
apps/sim/lib/file-parsers/zip-guard.test.tshttps://github.com/simstudioai/sim/pull/6166/files#diff-b8a14e85c6ff70831de6efe4b18e53eb3dd16020b3eed3d7139e6b37fa9a4f51
View file https://github.com/simstudioai/sim/blob/bea4e75ecb73000c9bd33bfadc7d3d0b7996b055/apps/sim/lib/file-parsers/zip-guard.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6166/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6166/files#diff-b8a14e85c6ff70831de6efe4b18e53eb3dd16020b3eed3d7139e6b37fa9a4f51
https://github.com/simstudioai/sim/pull/6166/files#diff-b8a14e85c6ff70831de6efe4b18e53eb3dd16020b3eed3d7139e6b37fa9a4f51
https://github.com/simstudioai/sim/pull/6166/files#diff-b8a14e85c6ff70831de6efe4b18e53eb3dd16020b3eed3d7139e6b37fa9a4f51
https://github.com/simstudioai/sim/pull/6166/files#diff-b8a14e85c6ff70831de6efe4b18e53eb3dd16020b3eed3d7139e6b37fa9a4f51
Please reload this pagehttps://github.com/simstudioai/sim/pull/6166/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6166/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.