# WebDAV hardening - Status: SHIPPED with PUT crypt plus GET decrypt plus WORM - Spec: FR-09, SEC-05, SEC-07 - Sources: `tosv.cpp` dav block, `tosv.cpp.bak` diff, tasks WebDAV research section, SPEC.md 6.2 ## What it is RFC 4918 class 1 served in-binary on the same port: OPTIONS, PROPFIND, MKCOL, PUT, GET, HEAD, DELETE, COPY, MOVE, LOCK, UNLOCK, PROPPATCH. Same grant Basic auth plus [IP gate](sec-ip-gate.md) as fetch, `..` stripped from every path, XML responses escaped, store users admitted explicitly. No library: hand-rolled on the existing parser per the research verdict (0 deps, own license). ## How TOSV does it `dav_auth` matches grant or store pairs, `dav_path` URL-decodes, strips the `/dav` prefix, loops out every `..`, and roots under the store dir. PROPFIND builds multistatus XML with `&` and `<` escaping and honors Depth 0/1/infinity. COPY and MOVE re-resolve Destination through the same sanitizer. PUT/GET crypt like store and fetch after the M2 fix. ## What it protects against Drive-mount abuse: traversal escapes, XML injection into clients, and anonymous browsing. It reuses the grant threat model instead of inventing a second one, so every DAV caller is already a known identity with gates. ## Attack realism High for mounts: Finder, Explorer, davfs2, and rclone all speak this subset, and traversal plus injection are their classic server bugs. The sanitizer loop plus escaper close both. Realism limit: class 1 LOCK is a stub token, so two writers can still collide; real leases are v2 (see [future platform](sec-future-platform.md)). ## Pros Zero new deps or license weight. One auth model across HTTP and DAV. Mountable by every major client for the documented subset. ## Cons and how the vault resolves them - Legacy PUT stored plaintext. Resolved by FR-09 mandate: PUT crypts like [store](sec-layers.md), GET decrypts like fetch, Gate 2 mounts and round-trips through rclone or cadaver. - LOCK/UNLOCK/PROPPATCH are stubs. Accepted for class 1 file use; real 30s leases plus conflict policy arrive with two-way drive work, see [modes](sec-modes.md). - DELETE honors remove-all. Resolved by [modes](sec-modes.md): append-only default denies DAV DELETE and MOVE unless two-way is on; every call is [audited](sec-audit.md) either way. - Destination header parsing is hand code. Resolved by funneling both source and destination through the same sanitizer plus a Gate 2 traversal battery (`..`, encoded dots, absolute paths). ## Residual risk Client quirks outside the tested subset. rclone 1.75.2 verified PUT, PROPFIND, GET, and DELETE round-trips in Gate 2; cadaver and Explorer stay untested and welcome. M6: PROPFIND 404s on missing paths with a 10k entry cap, COPY and MOVE audit separately, HEAD works on collections. ## See also - [Security index](security.md), [layers](sec-layers.md), [modes](sec-modes.md), [transport](sec-transport.md)