Skip to content

fix: raise CardDAV parser entity cap for large address books#231

Open
salmonumbrella wants to merge 2 commits into
maathimself:mainfrom
salmonumbrella:fix/carddav-entity-expansion-limit
Open

fix: raise CardDAV parser entity cap for large address books#231
salmonumbrella wants to merge 2 commits into
maathimself:mainfrom
salmonumbrella:fix/carddav-entity-expansion-limit

Conversation

@salmonumbrella

Copy link
Copy Markdown

Summary

Large CardDAV address-book REPORTs can exceed fast-xml-parser's default entity-expansion limit. This change raises that limit to a generous finite cap and fails closed when a server reports a truncated snapshot.

Changes

  • configure the existing parser with a finite 10_000_000 total-expansion cap while preserving the previous depth setting
  • reject top-level 507 Insufficient Storage multistatus responses before extracting any cards
  • retain the large-address-book regression and add coverage proving truncated results never return a successful subset

Testing

  • npx vitest run — 11 test files, 276 tests passed under Node 22.20.0
  • npm run lint
  • node --check src/index.js
  • git diff --check main...HEAD

Contributor License Agreement

By submitting this pull request I confirm that:

  • I have read and agree to the Contributor License Agreement.
  • My contribution is my own original work (or I have identified any third-party material and confirmed it is compatible with the CLA).
  • I have the right to submit this contribution under the terms of the CLA.

salmonumbrella and others added 2 commits July 10, 2026 00:56
fast-xml-parser >=4.5.5 defaults processEntities.maxTotalExpansions to
1000. A CardDAV addressbook-query REPORT for a large address book carries
far more counted entity references than that (</>/" in vCard
data), so parseCards threw "Entity expansion limit exceeded" and the whole
sync failed.

Lift the count cap. Passing an object for processEntities also flips
maxExpansionDepth from its boolean-mode default of 10 to 10000, so pin it
back to 10 to keep this change scoped to the single intended knob.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use a generous finite expansion cap while preserving the previous depth setting without claiming fast-xml-parser enforces it. Reject top-level 507 multistatus responses before extracting cards so truncated snapshots cannot return partial results.
@salmonumbrella salmonumbrella marked this pull request as ready for review July 10, 2026 08:38
@MikeScanlan5

Copy link
Copy Markdown

Thanks for opening this as part of my bug report. 🙏🏼🙏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants