Skip to content

[Refactor]: remove xmltree from the AsterDrive XML stack #433

Description

@AptS-1547

Context

AsterDrive currently depends on xmltree for WebDAV DOM construction, WebDAV request/dead-property handling, LOCK owner persistence, DeltaV responses, WOPI discovery, and Tencent COS XML parsing.

The WebDAV security fix in #410 added Forge-owned non-recursive XML validation before untrusted XML reaches xmltree, but xmltree still uses unbounded recursive DOM construction and has no element-depth limit. The upstream crate documentation only warns about memory use for large XML documents.

Goal

Remove the production and test dependency on xmltree and use maintained, bounded XML paths owned by AsterForge or the relevant product boundary.

Proposed scope

  • Replace WOPI discovery and Tencent COS XML parsing with typed quick-xml readers where the XML schema is known.
  • Replace WebDAV request parsing with Forge validation plus event-based or typed parsing.
  • Replace WebDAV response construction with quick-xml::Writer or a small product-owned writer boundary.
  • Replace DavLock.owner: Option<Box<xmltree::Element>> with an owned product representation or validated XML bytes.
  • Preserve dead-property XML, namespaces, LOCK owner round-tripping, DeltaV response compatibility, and COS/WOPI behavior.
  • Remove xmltree from Cargo.toml, Cargo.lock, production code, tests, and crash-probe comments.

Constraints

  • Keep Forge as the owner of reusable XML safety validation.
  • Do not replace xmltree with another unbounded recursive DOM parser.
  • Keep body-size limits, depth limits, DTD/ENTITY rejection, and malformed-document handling at every untrusted or remote XML boundary.
  • Split the migration into reviewable phases instead of changing every XML path in one large patch.

Acceptance criteria

  • rg -n "xmltree::|use xmltree|xmltree =" src tests Cargo.toml Cargo.lock returns no production or test dependency.
  • WebDAV full integration tests pass, including dead properties, LOCK owner round-trips, DeltaV, partial COPY/MOVE, and deep XML rejection.
  • WOPI discovery and Tencent COS XML tests pass.
  • Forge XML safety tests remain the shared boundary regression suite.
  • No public API or wire-format regression for WebDAV, WOPI, or COS integrations.

Related

Metadata

Metadata

Assignees

Labels

DocumentationImprovements or additions to documentationEnhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions