Skip to content

C1: calcraft-client CalDAV/CardDAV protocol library - #1

Merged
jan-runkel-zeitgleich merged 2 commits into
mainfrom
c1-client-library
Oct 21, 2026
Merged

jan-runkel-zeitgleich merged 2 commits into
mainfrom
c1-client-library

Conversation

@jan-runkel-zeitgleich

Copy link
Copy Markdown
Contributor

Summary

Milestone C1 of CalCraftApp: a standards-based CalDAV/CardDAV client library that works with CalCraft and other servers.

  • Discovery (RFC 6764, current-user-principal, calendar/addressbook home sets)
  • Collections: list (name, color, description, components, ctag, sync-token), MKCALENDAR, extended MKCOL, PROPPATCH, delete
  • Sync: sync-collection incl. 507 truncation and invalid-token resync; ctag + Depth 1 fallback (permanent only on 501 / supported-report)
  • Objects: batched multiget (only requested hrefs accepted), get, put with If-None-Match: * / If-Match, delete; typed errors for 412 and weak etags
  • HttpTransport trait; default hyper + rustls (ring, webpki roots + optional extra CAs), HTTPS required except loopback
  • Security: one origin per client (no cross-origin requests, hrefs or redirects), XML limits (bytes, depth, elements, DTD/entities rejected), RFC 4918 multi-href rule, total sync entry cap, header-injection-safe etags, zeroized credentials, no logging
  • Dependencies: core = quick-xml + zeroize; default transport adds hyper/rustls (39 crates total)
  • License: still open (MPL-2.0 or MIT/Apache-2.0) — no LICENSE file yet

Implemented by an Opus agent; Haiku review found a memory-amplification blocker and five more issues, all fixed with regression tests.

Test plan

  • 79 tests (unit, discovery, collections, objects, sync, hostile responses) with CalCraft-, sabre/Nextcloud-, Radicale- and iCloud-style fixtures
  • live round-trip against a running CalCraft server
  • fmt, clippy (both feature sets), docs, cargo-deny
  • CI on Linux/macOS/Windows

🤖 Generated with Claude Code

jan-runkel-zeitgleich and others added 2 commits October 21, 2026 22:50
calcraft-client implements service discovery (RFC 6764 well-known,
current-user-principal, home sets), collection listing and management
(MKCALENDAR, extended MKCOL, PROPPATCH), sync-collection (RFC 6578) with
507 continuation and invalid-token resync plus a ctag/etag fallback,
batched calendar-/addressbook-multiget and conditional PUT/DELETE with a
typed 412 conflict error.

Security: one origin per client (foreign URLs refused before sending,
foreign hrefs dropped, cross-origin redirects not followed), HTTPS
required except for loopback, zeroized and redacted credentials, hardened
quick-xml parsing (size/depth/element limits, no DTDs or custom entities,
namespace-resolved), strict URL/href canonicalisation.

All I/O goes through the HttpTransport trait; the default hyper-transport
feature provides hyper + rustls (ring, webpki-roots, optional extra CAs).

Tests replay CalCraft, sabre/Nextcloud and Radicale style responses and
hostile inputs through a mock transport; a live test runs against a real
server when CALCRAFT_TEST_URL is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jan Runkel <jan.runkel@zeitgleich.de>
- multistatus: consume the element tree instead of cloning propstats per
  href, and enforce RFC 4918 (several hrefs only with a status and no
  propstat); a 5,000-href/5,000-prop response is now rejected cheaply
- sync: cap accumulated entries across truncated pages
  (ClientOptions::max_sync_entries, default 200,000)
- sync: fall back to ctag permanently only on clear signals (501 or a
  DAV:supported-report precondition); other 4xx fall back for this run
  and keep the sync token
- discovery: drop foreign or malformed hrefs in properties; error only
  when no usable href remains
- objects: refuse weak entity tags for If-Match with Error::WeakEtag
  instead of sending a precondition that can never match
- CI: build with --locked

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jan Runkel <jan.runkel@zeitgleich.de>
@jan-runkel-zeitgleich
jan-runkel-zeitgleich merged commit e5a4f7e into main Oct 21, 2026
5 checks passed
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.

1 participant