Self-hosted CalDAV/CardDAV server written in Rust, with an optional web interface.
Status: pre-release, 0.1.0-alpha.4. Not ready for production use; what is still missing is tracked in docs/produktionsreife.md (German).
- Standards-compliant CalDAV (RFC 4791) and CardDAV (RFC 6352)
- Security first: no
unsafe, audited dependencies, fuzzed parsers, strict defaults - Single binary, optional Docker image
- Optional web UI (Leptos) and REST API with OpenAPI – both can be disabled
- Local users or SSO via OpenID Connect (e.g. Keycloak), with per-device app passwords
- Support for iCalendar, jCal, xCal, vCard 3/4, jCard, CSV and webcal subscriptions
See PLAN.md for the roadmap.
The optional web UI, shown with fictional demo data:
cargo build --releaseCargo features of calcraft-server:
| Feature | Default | Description |
|---|---|---|
web-ui |
yes | Embedded web interface |
api |
yes | REST API |
oidc |
yes | Single sign-on via OpenID Connect (implies api; adds an HTTPS client: rustls/ring) |
update-check |
yes | Optional update notice for administrators (implies api; same HTTPS client; off unless [updates] check = true) |
migrate |
yes | calcraft migrate from another CalDAV/CardDAV server (same HTTPS client) |
CalCraft runs on Linux, macOS and Windows.
The web interface is a Leptos application (crates/calcraft-ui) compiled to
WebAssembly. Its files are embedded into the server binary at build time, so
build them first:
rustup target add wasm32-unknown-unknown # listed in rust-toolchain.toml
cargo install wasm-bindgen-cli --version 0.2.114 --locked # must match crates/calcraft-ui/Cargo.toml
scripts/build-ui.sh # Windows: scripts/build-ui.ps1
cargo build --releaseWithout these assets the server still builds but shows a placeholder page on /;
set CALCRAFT_UI_REQUIRED=1 to make missing assets a build error. No npm or other
JavaScript tooling is needed.
The UI covers login (with two-factor codes), calendars and address books, account
settings (password, TOTP), app passwords and user administration. Disable it at
runtime with web_ui.enabled = false or calcraft serve --no-web-ui.
Logo, icons and colours: docs/brand.md.
Minimal DAV-only build:
cargo build --release -p calcraft-server --no-default-featuresA step-by-step guide for production setups — DNS records, build or Docker, systemd service, TLS with Let's Encrypt and ready-to-use nginx and Apache configurations — is in docs/installation.md.
The Linux release archives contain the systemd unit, sysusers.d and
tmpfiles.d files from contrib/systemd/ (installation:
section 6 of the guide).
Released binaries (Linux, macOS, Windows) and the Docker image
ghcr.io/zeitgleich/calcraft come with SHA-256 checksums, build provenance
attestations and a keyless cosign signature; how to check them is described in
docs/release-verification.md. Maintainers: see
docs/releasing.md and CHANGELOG.md.
Create a user (the password is prompted for, or read from stdin with --password-stdin;
it is never accepted as an argument):
calcraft user add alice --display-name "Alice"Start the server:
calcraft serve --config calcraft.tomlPoint your client at https://your-host/ – discovery via /.well-known/caldav and
/.well-known/carddav leads to /dav/. Always run CalCraft behind TLS: DAV clients
use HTTP Basic authentication.
Other user commands: calcraft user list|passwd|disable|enable|set-admin|allow-sso-link|unbind-sso
(calcraft user add alice --admin creates an administrator).
CalCraft rejects excess requests immediately instead of queueing them:
- at most
server.max_concurrent_requests(256) requests at the same time, further ones get503withRetry-After(/healthzand/readyzare exempt); - per client 32 concurrent requests and a token bucket of 120 requests, refilled with
20 per second (
429withRetry-After); - per client 20 failed logins in 15 minutes (DAV, web UI, second factor; known and unknown usernames), in addition to the lockout per account (5 in 15 minutes). Further logins from that client fail exactly like wrong credentials.
IPv6 clients count per /64 (client_ipv6_prefix). The per-client tables are capped
(max_tracked_clients, idle entries are evicted), so address hopping cannot exhaust
memory. Blocked entries are never evicted; if an attacker fills the table with
blocked networks (cheap with IPv6), new clients are not counted per client until
those entries expire, and only the per-account lockout applies. The client is the
TCP peer address; X-Forwarded-For is only used when the
peer is listed in server.trusted_proxies, read from the right and skipping trusted
proxies, so entries a client adds itself are ignored. The default
["127.0.0.1/32", "::1/128"] fits a reverse proxy on the same host; a local process
could then choose its client address, set [] if that matters. A proxy on another
host or a Docker bridge must be listed, otherwise all users share the proxy's limits;
CalCraft logs a warning once when it ignores X-Forwarded-For (see
docs/installation.md).
| Limit | Default | Setting |
|---|---|---|
| Request body | 10 MiB | server.max_body_bytes |
| Calendar object | 1 MiB | fixed (CALDAV:max-resource-size) |
| vCard incl. embedded photos | 2 MiB (less if server.max_body_bytes is smaller) |
storage.max_vcard_bytes, 64 KiB – 10 MiB, at most server.max_body_bytes (CARDDAV:max-resource-size) |
| Storage per user | 512 MiB | fixed, counts the stored bytes (base64 photos included) |
Larger objects are rejected with 403 and the max-resource-size precondition;
a body announced larger than server.max_body_bytes gets 413. A reverse proxy
must allow at least server.max_body_bytes (see docs/installation.md).
Photos and logos (PHOTO, LOGO) are accepted embedded – vCard 3.0
ENCODING=b;TYPE=JPEG:<base64> (also ENCODING=BASE64), vCard 4.0
data:image/…;base64,… – if the base64 is syntactically valid, every declared
type (all TYPE values, the data: media type) is JPEG, PNG, GIF or WebP, and
the magic number of the first (at most 12) decoded bytes is one of them, with or
without a declared type; ENCODING/VALUE must not contradict each other. Or as
an http/https URI, which is stored but never fetched. Empty values are accepted, as they occur in exports. Anything else
(javascript:, file:, SVG, invalid base64) is rejected with
CARDDAV:valid-address-data. Apart from that magic number, image bytes are never
decoded or interpreted, and photos are never served as image/*.
Groups – vCard 4.0 KIND:group with MEMBER, Apple's
X-ADDRESSBOOKSERVER-KIND:group with X-ADDRESSBOOKSERVER-MEMBER – are ordinary
vCards with their own UID. Like every object they are stored and returned
byte for byte as uploaded.
calcraft backup /var/backups/calcraft-$(date +%F).db # online, while the server runs
calcraft restore --yes /var/backups/calcraft-2026-10-21.db # server stoppedBefore applying database migrations, CalCraft writes a backup
calcraft.db.pre-migration-<version>-<timestamp> next to the database (the last 3
are kept). Migrations are forward-only; to roll back an upgrade, restore that
backup with the previous version. Details in
docs/backup-and-upgrade.md.
Time-range queries, recurrence and time zones (what is exact, what is
conservative, budgets): docs/caldav.md.
Deleting a calendar entry, contact, calendar or address book (from a DAV
client or the web UI) moves it into the owner's trash for
storage.trash_retention_days (default 30; 0 disables the trash). DAV
clients see the deletion as usual. On the Trash page (or
/api/v1/trash) users restore entries – into the original collection under
the original name, so clients sync them back – or delete them permanently.
A deleted collection goes to the trash with all its entries and is restored
as a whole; entries whose collection was deleted permanently can be
restored into another collection. The trash counts towards the user's storage
quota until it is emptied or its entries expire; expired entries are purged
at startup and hourly.
Deleted data stays on the server (and in backups) for the retention period,
which matters for deletion requests (GDPR Art. 17): users remove it at once
with Empty trash / Delete permanently; operators can set
trash_retention_days = 0 and restart, which purges all trash entries
of all users (CalCraft logs a warning with their number). Backups taken
before keep the data until they are rotated.
Optionally, the admin area shows a notice when a new release is out:
[updates]
check = true # default: false
interval_hours = 24 # 1-168CalCraft then requests https://api.github.com/repos/Zeitgleich/CalCraft/releases/latest
at startup and every interval_hours (plain GET, no cookies, no credentials, nothing
about your installation). GitHub sees the server's IP address and the User-Agent
calcraft/<version>. Drafts and pre-releases are ignored; the result is kept in memory
only and is also available as GET /api/v1/admin/update.
Each device should get its own app password (ccap_…), created
in the web UI (or via POST /api/v1/app-passwords) and revocable individually.
Once two-factor authentication (TOTP) is enabled for an account, DAV clients must
use app passwords; the account password then only works together with a code.
The REST API is described in /api/openapi.json.
The web UI can log in via any OpenID Connect provider (Keycloak, Authentik, Zitadel, Entra ID, …) using the Authorization Code flow with PKCE. DAV clients cannot do OIDC, so SSO users create app passwords for their devices.
Keycloak example: create a client calcraft in realm main (Client authentication
on, Standard flow only), set the valid redirect URI to exactly
https://cal.example.com/api/v1/auth/oidc/callback and copy the client secret.
For admin rights from a group, add a Group Membership mapper (claim groups,
"Add to ID token" on; full group path gives values like /calcraft-admins).
[oidc]
enabled = true
issuer = "https://keycloak.example.com/realms/main"
client_id = "calcraft"
# Secret via file or CALCRAFT_OIDC__CLIENT_SECRET instead of the config file:
client_secret_file = "/run/secrets/calcraft-oidc"
redirect_uri = "https://cal.example.com/api/v1/auth/oidc/callback"
scopes = ["openid", "profile"]
username_claim = "preferred_username"
# Optional: admin rights follow this group (granted and revoked on each login).
admin_claim = "groups"
admin_value = "/calcraft-admins"
# Create unknown users on first login (default: an admin creates them first).
auto_create_users = false
button_label = "Sign in with Keycloak"How accounts are matched:
- The configured claim (default
preferred_username) must be a valid CalCraft username after lowercasing (and optionally removingusername_strip_suffix, e.g.@example.comfor UPNs); it is never rewritten. E-mail addresses are never used. - Accounts created via SSO (
auto_create_users) are bound to the IdP identity (issuer + subject) at creation. An existing local account is never linked just because the name matches: an operator approves exactly one IdP account withcalcraft user allow-sso-link <user> --subject <sub> [--hours 1](the subject is the user's ID in the IdP admin console, e.g. Keycloak's user ID; valid 1 h by default, at most 24 h). Only the next SSO login with that issuer + subject binds the account and consumes the approval; any other IdP account with the same name fails withaccount_existsand leaves the approval in place. - Once bound, logins must present the same subject, so a different IdP account with
the same username cannot take over.
calcraft user unbind-sso <user>(or Unlink SSO in the administration page) removes the binding and ends the user's sessions; linking again then needs a newallow-sso-linkapproval. - Where to see the link: the Account page shows "Linked to single sign-on () since …" or "Not linked to single sign-on" (only when SSO is configured; from
ssoinGET /api/v1/me, which never contains the IdP subject). Administrators see an SSO badge per linked user in the user list (sso_linkedinGET /api/v1/admin/users). - The IdP should not let users choose their username freely (open self-registration),
otherwise someone can claim a name before its owner does. If it does, restrict SSO
with
required_claim/required_value(e.g. a group only admins assign). - Disabled accounts cannot log in. Accounts created via SSO have no usable password
until an administrator sets one (
calcraft user passwd). - By default SSO logins do not ask for the local TOTP code: MFA is the IdP's job.
With
require_local_totp = true, accounts with local 2FA cannot use SSO (local_2fa_required). [security] password_login = falsemakes SSO the only interactive login: the password login API and DAV Basic auth with the account password are refused, app passwords keep working; changing the password and local 2FA setup are refused too (password_login_disabled). CalCraft refuses to start this way without[oidc].- Pending logins are kept in a bounded table (oldest evicted); the per-client request limits (see above) also apply to the SSO endpoints. Failed SSO callbacks do not count as failed logins (they involve no guessable secret).
The UI learns whether SSO is available from GET /api/v1/auth/methods. Errors are
reported by redirecting to /?sso_error=<code>. Discovery, JWKS and token endpoints
must be https on the issuer's host (extra_endpoint_hosts allows more, e.g. Google's
www.googleapis.com); the system trust store is used, ca_file adds a private CA.
To try it against a real Keycloak locally (verified with Keycloak 26.4):
docker run --rm --name kc -p 127.0.0.1:8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
-e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.4 start-devIn the admin console (http://127.0.0.1:8080, admin/admin) create realm main, the
client as above with redirect URI http://localhost:5232/api/v1/auth/oidc/callback,
and a user. Then run CalCraft with issuer = "http://127.0.0.1:8080/realms/main",
that redirect URI, [security] secure_cookies = false and
allow_insecure_issuer_for_testing = true (plain HTTP – never in production), open
http://localhost:5232/api/v1/auth/oidc/login and log in. Use the same host name for
the issuer everywhere: Keycloak derives iss from the URL it is called with.
Stop the container with docker stop kc.
Users can subscribe to published calendars (webcal:// or https:// links to an
iCalendar feed, e.g. holidays, sports schedules, a shared Outlook or Google
calendar). The server fetches the feed and stores its events in a read-only
calendar, so every CalDAV client (Apple Calendar, Thunderbird, DAVx⁵, …) shows it
like any other calendar and syncs it with sync-collection; clients never contact
the feed themselves. Subscriptions are off by default because the server then
makes outbound requests to addresses its users choose:
[subscriptions]
enabled = true
# Optional: only these hosts (also after redirects), or never these.
# allowed_hosts = ["calendar.google.com", "*.example.org"]
# denied_hosts = ["intranet.example.org"]In the web UI: Overview → Subscribed calendars → Subscribe to calendar (link, name,
color, refresh interval), with the last refresh, errors, Refresh now (at most once
a minute) and Unsubscribe. REST API: GET/POST /api/v1/subscriptions,
PATCH/DELETE /api/v1/subscriptions/{slug}, POST /api/v1/subscriptions/{slug}/refresh.
- Refreshing: in the background, per subscription every 15 minutes to 7 days
(the owner's choice, otherwise the feed's
REFRESH-INTERVAL/X-PUBLISHED-TTL, otherwisedefault_refresh_minutes, 6 hours), with random jitter, at mostmax_concurrent_fetches(2) at a time and conditional requests (If-None-Match,If-Modified-Since). Only events that really changed get a new ETag and sync revision, so clients do not download the whole calendar on every refresh. A feed that fails (unreachable, HTTP error, not iCalendar, too large, quota) keeps its last good content; the error is shown to the owner and retries back off (15 minutes, doubling, up to a day). - Limits: the feed goes through the same parser and validation as an import
(1 MiB per event, 10 000 events), counts towards the owner's storage quota, and
may have at most
max_bytes(10 MiB). Each user may havemax_per_user(20) subscriptions, 10 subscribe attempts and 10 Refresh now per 10 minutes. A request waits at most 10 s for a free fetch slot (otherwise503 busy), and at most two background refreshes per slot are queued; the rest waits for the next minute. - Read-only: PUT, DELETE, COPY/MOVE into and PROPPATCH of a subscription answer
403withDAV:need-privileges, andcurrent-user-privilege-setonly containsread. Name and color can be changed in the web UI. Unsubscribing (or deleting the calendar) removes it permanently instead of moving it to the trash: subscribing again restores the content. - Feed URLs can contain secrets (many services put an access token into the link). They are stored in the database (and therefore in backups) and shown only to their owner; logs only ever contain the host name.
SSRF protection (lessons from Nextcloud, OX and others, see
docs/security/angriffshistorie.md): only
https (webcal means https; plain http only with allow_http = true); no user
name or password in the URL; only allowed_ports (443, plus 80 with allow_http);
at most 2048 characters; host names must be fully qualified ASCII names (xn-- form
for internationalised names) – numeric forms like 2130706433, 0x7f.1 or 127.1,
single-label names and localhost, .local, .internal, .home.arpa are refused.
CalCraft resolves the name itself and refuses it if any of its addresses is not
public: loopback, private (RFC 1918), carrier-grade NAT, link-local (including the
cloud metadata address 169.254.169.254), 0.0.0.0/8, multicast, broadcast and
reserved, documentation and benchmarking ranges, IPv6 outside 2000::/3
(::1, fc00::/7 incl. fd00:ec2::254, fe80::/10, NAT64 64:ff9b::/96), 6to4,
Teredo and other 2001::/23 assignments; IPv4-mapped IPv6 addresses are judged by
their IPv4 address. The connection then goes to exactly the checked address (with
the real name for TLS SNI, certificate check and Host), so DNS rebinding cannot
redirect it. Redirects are followed manually (at most max_redirects, 3) and every
hop is checked again; https → http is never followed. Every fetch has one deadline
(timeout_secs, 30 s, plus 10 s per connection attempt), a size limit, no cookies,
no credentials and the fixed User-Agent calcraft/<version>. Error messages are
generic (fetch_failed) so that the server cannot be used to scan ports or probe
internal DNS names: a name that resolves to a private address, does not exist or
times out gives the same answer (the precise reason is logged, with the host
only); blocked_address is only returned for address literals and local names.
System DNS lookups run at most four at a time, so stuck lookups cannot exhaust
the threads shared with imports.
Subscriptions with their own credentials (HTTP Basic) are not supported.
CalDAV scheduling (RFC 6638) between users of the same server, off by
default: an organizer saves an event with attendees, the server puts the
invitation into each attendee's calendar and inbox, their answers
(PARTSTAT) come back into the organizer's event, and changes and
cancellations follow. Users can also look up each other's busy times.
Invitations to addresses outside this server are not sent yet (no e-mail;
SCHEDULE-STATUS 5.3).
[scheduling]
enabled = true
# Optional: every user gets mailto:<username>@example.org.
domain = "example.org"Further addresses are e-mail addresses set by an administrator
(calcraft user set-email alice alice@example.com, the web UI or
PATCH /api/v1/admin/users/{username}), never taken from SSO. Only a user's
own address can be ORGANIZER of what they schedule; attendees can change only
their own participation status in the organizer's event. Limits: attendees
per event, recipients per user and hour, bytes received per user and hour,
size of a delivered copy, inbox size; deliveries count towards the
recipient's quota. Every user can refuse invitations (Settings). Details, status codes and deviations from the RFC:
docs/scheduling.md.
CalDAV managed attachments (RFC 8607), off by default: clients upload a
file to an event (POST …?action=attachment-add), the server stores it in
the database and adds an ATTACH with a download URL below
/dav/attachments/. Invitations carry it to the attendees, who can download
but not change it.
[attachments]
enabled = true
# Scheme and host of the download URLs (never taken from the Host header).
base_url = "https://cal.example.org"
# max_bytes = 10485760 # per attachment, only uploads may be this large
# max_per_object = 20
# max_bytes_per_user = 268435456Downloads need the DAV credentials and are allowed for the uploader and for
users whose own events reference the attachment (an invitation); everything
else is 404. Files are always sent as downloads (Content-Disposition: attachment, nosniff, a sandboxing CSP, only harmless media types), file
names are sanitised, a managed id of somebody else in a PUT is refused.
Attachments count towards the uploader's quota, stay with an object in the
trash and go when nothing references them any more. Details and deviations
from the RFC: docs/attachments.md.
Users can share calendars and address books with other users of the server
(on by default, [sharing] enabled), read-only or read-write. A share
is an invitation until the sharee accepts it (web UI, REST API or Apple
Calendar's invitation); then it appears in the sharee's own home
(/dav/calendars/<sharee>/<owner>-<slug>/), so every client sees it.
Sharees can decline and leave at any time; the owner keeps sole control of
the collection, its settings and its shares. Sharees' writes count against
the owner's quota, deletions go into the owner's trash, and they are never
scheduled (no invitations in the owner's name). Read-only sharees see private
events (CLASS:PRIVATE/CONFIDENTIAL) only as busy stubs. Apple's CalendarServer
sharing (CS:share, notifications, CS:invite-reply) is implemented.
Calendars can also be published as secret read-only links
(<base_url>/public/<token>.ics, also webcal://), off by default:
[publish]
enabled = true
base_url = "https://cal.example.org"Tokens have 256 bits and are stored hashed, every wrong token is the same
404, guessing clients are blocked; links can be "busy only", private
events are busy blocks by default, and attachments, alarms and (unless the
owner opts in) attendee addresses are never published. Rights table, Apple
compatibility and deviations: docs/sharing.md.
Calendars can be exported and imported as iCalendar (ics), jCal (jcal), xCal
(xcal) and CSV (csv); address books as vCard 3.0/4.0 (vcf), jCard (jcard) and
CSV. On the command line:
calcraft export --user alice --collection calendar/default --format ics > alice.ics
calcraft import --user alice --collection calendar/default --format ics alice.ics
calcraft import --user alice --collection addressbook/default --format csv \
--on-conflict replace contacts.csv # `-` reads standard inputVia the REST API (session cookie; import needs the X-CalCraft-Request header):
GET /api/v1/collections/{kind}/{slug}/export?format=… and
POST /api/v1/collections/{kind}/{slug}/import?format=…&on_conflict=skip|replace
with the file as body. The import answers with counts of created, replaced, skipped
and rejected objects and the reasons for the first 20 rejections.
Every imported object is validated exactly like a CalDAV/CardDAV upload, and the
storage quota and object limits apply. Files may have at most 20 MiB and 10 000
objects; via HTTP the global server.max_body_bytes (10 MiB by default) applies
as well, so import larger files with the CLI. The converted objects may take at most
four times the file size (64 MiB at most), which bounds the copies of time zones.
Events are grouped by UID together with their recurrence overrides, and
the referenced time zones are copied into each object. Objects whose UID already
exists in the collection are skipped unless on_conflict=replace is given.
CSV columns are summary,start,end,all_day,location,description,uid for events and
name,emails,phones,org,uid for contacts (several values separated by ;). CSV
exports hold events only (the master of a recurring event, without its rule), and
cells starting with =, +, -, @, TAB or CR are prefixed with ' so that
spreadsheets do not evaluate them; the import removes this prefix again.
calcraft migrate copies all calendars, task lists and address books of one
account on another CalDAV/CardDAV server into a CalCraft user. It finds them via
.well-known, current-user-principal and the home sets, keeps name, color,
description and component set (VEVENT/VTODO/VJOURNAL) of each collection, and
imports every object through the same validation as calcraft import, keeping
its UID. Valid objects are stored as received, after validation and after line
endings are normalised to CRLF (multiget responses carry the data inside XML,
whose parsing turns CRLF into LF); a resource with several UIDs is split, one
without UID gets a UID derived from its source name.
calcraft migrate --from https://nas.example.com:5001/caldav/ \
--carddav-from https://nas.example.com:5001/carddav/ \
--source-user alice --user alice --dry-run| Source | --from (placeholders) |
Notes |
|---|---|---|
| Synology Calendar / Contacts | https://<nas>:5001/caldav/ plus --carddav-from https://<nas>:5001/carddav/ |
Self-signed certificate: export it (or your own CA) as PEM and pass --ca-file nas.pem. |
| Radicale | https://<host>:5232/ |
|
| Baïkal | https://<host>/dav.php/ |
|
| Nextcloud | https://<host>/remote.php/dav/ |
Use an app password; shared calendars only with --include-shared. |
- Password: prompted for, or the first line of
--password-file <file>(a regular file, not a link, mode600), orCALCRAFT_MIGRATE_PASSWORD; never on the command line, never in the URL, never printed or logged, and wiped from memory when no longer needed. The environment variable is not removed from the process environment (that needsunsafecode, which CalCraft forbids), so prefer the prompt or the file. It is sent as HTTP Basic, only to the origin of--from. - Options:
--dry-run(discover, fetch and validate, write nothing),--only calendars|addressbooks,--map source-slug=target-slug(repeatable; otherwise the slug comes from the last path segment of the source, made safe),--on-conflict skip|replace(UIDs already in the target collection; defaultskip),--include-shared,--batch-size(multiget, default 50),--max-response-mib(default 32),--timeout(seconds per request, default 60),--delay-ms(pause before each request). - Idempotent: existing target collections are reused (their properties are
not changed), and with
skipa second run copies only what is new, so an interrupted run can simply be repeated. - Objects come via
calendar-multiget/addressbook-multigetin batches, or one by one withGETif the server has no multiget. Scheduling inboxes/outboxes, notifications and webcal subscriptions are skipped;calendar-timezoneis not stored (objects carry their ownVTIMEZONE). The report lists per collection how many objects were created, replaced, skipped and rejected, with reasons but without contents; the exit code is non-zero if a collection could not be copied completely. - Network rules: HTTPS only, with the system trust store plus
--ca-file; there is no switch to disable certificate checks.--allow-httppermits plain HTTP with a warning (password and data unencrypted). Redirects are followed only within the origin, or fromhttptohttpson the same host and port (or from port 80 to 443); a redirect to another port, such as Synology's 5000 → 5001, is refused – pass thehttps://…:5001/URL instead. Hrefs pointing elsewhere are ignored, and URLs in messages lose query and fragment. Once the quota or object limit is reached, the rest of a collection is not fetched (reported as skipped). Private and loopback addresses are allowed: unlike server-side fetches such as webcal subscriptions, where users choose URLs and SSRF rules keep the server out of its own network, this command is run by the administrator against a server they name – usually a NAS on the local network. - Limits: responses up to
--max-response-mib, objects up to the object size limit (1 MiB, vCardsstorage.max_vcard_bytes), at most 100 000 objects per collection; quota and limits of the target user apply.
See calcraft.example.toml. Every setting can be overridden via
environment variables with the prefix CALCRAFT_ and __ as separator,
e.g. CALCRAFT_SERVER__BIND=0.0.0.0:5232.
Numbers as of 2026-10-23 (version 0.1.0-alpha.4); they are not updated automatically.
cargo test --workspace --all-features runs 701 tests (1 of them
ignored by default, see below): 456 unit tests in the crates' src/ and
245 integration tests in tests/ directories. There are no doc tests.
| Crate | Unit | Integration |
|---|---|---|
| calcraft-core | 6 | – |
| calcraft-dav | 38 | – |
| calcraft-ical | 106 | 12 |
| calcraft-server | 165 | 233 |
| calcraft-store | 118 | – |
| calcraft-ui (host tests) | 21 | – |
| calcraft-web | 2 | – |
Integration suites of calcraft-server (crates/calcraft-server/tests/):
- Authorization matrix (
authz_matrix.rs): every routed DAV method and unknown methods × every kind of path (own, another user's, a nonexistent user's, traversal and percent-encoding variants) × every kind of credential; COPY/MOVE with 13Destinationvariants; every REST route fromapi::ROUTES. It checks exact status codes, byte-identical answers for foreign and nonexistent resources, that marker strings from the other user's data never leak, and that the other user's data is unchanged after every write. One run sends about 84 600 requests and makes over 326 000 counted assertions. A DAV method or REST route without a matrix entry makes it fail. - Protocols:
dav.rs,caldav.rs,carddav_sync.rs,carddav_photos.rs(photos, groups, size limits),recurrence.rs(RRULE expansion, time zones, budgets),move_copy.rs,trash.rs,http.rs,dead_properties.rs(calendar order and client-defined properties). - API and authentication:
api.rs,oidc.rs(against a mock IdP). - Limits and robustness:
limits.rs(global and per-client request limits, login throttling),stress.rs(32 parallel writers: no lost updates, no 500; a heavier variant with 64 writers is#[ignore]d and runs nightly on Linux),failures.rs(read-only database, full disk, aborted uploads). - Logs:
log_secrets.rschecks that passwords, tokens, TOTP and recovery codes, cookies, calendar/contact contents, scheduling messages and addresses, attachments (names, contents, ids), share requests and public link tokens never reach the logs. - Scheduling:
scheduling.rs(invitations, replies, cancellations, recurrence, Schedule-Tag, free/busy, limits, quota, disabled users, organizer spoofing, attendee tampering, UID hijacking, concurrent replies); the authorization matrix covers inboxes, outboxes and POST. - Sharing:
sharing.rs(read and read-write enforcement for every method, Apple share/invite-reply flow, REST API, revocation indistinguishable from nothing, disabled users, owner's quota and trash, scheduling and attachment rules, a share removed during writes),publish.rs(public links: options, headers, uniform 404, rate limit); the authorization matrix covers shared, pending, revoked and unshared collections and the new REST routes. - Attachments:
attachments.rs(add, update, remove, recurrence instances, size and count limits, quota with trash, download headers and hostile file names, foreign managed ids in PUTs, attendee access and its end, garbage collection, MOVE/COPY, backup/restore, parallel uploads); the authorization matrix covers the download URLs and attachment POSTs. - Subscriptions:
subscriptions.rs(subscription calendars are read-only for every DAV client),subscription_logs.rs(feed URLs never reach the logs); the SSRF rules and fetches against a local server are unit tests insrc/subscriptions/. - Data:
backup.rs,transfer.rs(import/export),migrate.rs(calcraft migrateagainst a fake CalDAV/CardDAV server behind TLS);calcraft-icalhas its owntransfer.rsfor the format conversions.
Further checks:
- Fuzzing (
fuzz/, cargo-fuzz): 6 targets (ical_object,dav_xml,recurrence,import,itip,attach). CI runs each of them for 60 s on every change and for 20 min nightly. - CI on Linux, macOS and Windows:
cargo fmt, Clippy, all tests with all features and DAV-only, wasm build of the web UI, a client compatibility run with python-caldav, an upgrade test from every older migration state and a backup/restore smoke test with the real binary. - cargo-deny (advisories, licenses, sources) on every change and an
advisory check daily; CodeQL (
security-extended) for Rust and the workflows on pushes and pull requests tomainand weekly. - Coverage: 92.2 % of lines (16 037 of 17 401), measured with
cargo llvm-cov --workspace --all-features; per crate and known gaps in docs/coverage.md. CI measures it on every pull request.
What CalCraft does, in short (details: docs/produktionsreife.md, German):
- Authentication: passwords hashed with Argon2id (with a dummy hash for unknown users against timing); per-device app passwords, stored only as hashes; TOTP two-factor authentication with hashed recovery codes; lockout per account (5 failures in 15 minutes) plus a throttle per client address (20 in 15 minutes, also for unknown names). A request cancelled after the password comparison has started still counts as a failure. OpenID Connect with PKCE; SSO accounts are bound to issuer + subject, and an existing local account is only linked after an explicit operator approval for one subject.
- Authorization: every DAV path is resolved against the authenticated owner in one place; another user's resources answer exactly like nonexistent ones. The authorization matrix test (see Tests) enforces this for every method and route.
- Input handling: XML without DTDs or entities, with depth, element and size limits; iCalendar and vCard are validated on upload, with limits for size, components, properties and parameters; request body, REPORT and import budgets; recurrence expansion with CPU budgets per object and per REPORT (see docs/caldav.md); contact photos are checked against JPEG/PNG/GIF/WebP magic numbers, never decoded and never served as images.
- Web UI and API: strict Content Security Policy (no inline scripts or
styles, same origin only),
HttpOnly,SameSite=StrictandSecuresession cookies, a required CSRF header on state-changing API requests, plusX-Frame-Options,Referrer-Policyand optional HSTS (security.hsts). - Attachments: off by default; downloads only for the uploader and
users whose events reference the file (never derived from event
content), always as downloads with
nosniffand a sandboxing CSP, never rendered on the server's origin (see Attachments). - Sharing: shares must be accepted; a shared collection is reachable
only below the sharee's own home, never at the owner's path; every write
of a sharee re-checks the share inside its transaction; public links are
off by default, hashed, uniform
404, rate-limited, never logged (see Sharing and public links). - Calendar subscriptions: off by default; the server fetches feeds only from public addresses it resolved and checked itself, pinned against DNS rebinding, with every redirect checked again (see Calendar subscriptions).
- Operations: global and per-client request limits,
X-Forwarded-Foronly fromserver.trusted_proxies, a verified backup before every database migration, and logs without secrets or contents (tested). - Supply chain: few dependencies, each justified; no
unsafecode (forbid); cargo-deny on every change, advisories also daily; Dependabot; all GitHub Actions pinned to commit hashes; CodeQL. Release archives carry SHA-256 checksums and Sigstore build provenance, the Docker image is signed with cosign (keyless) – see docs/release-verification.md. - Process: changes go through pull requests with the full CI; known attacks on other calendar and contact servers are collected in docs/security/angriffshistorie.md (German) together with the countermeasures and regression tests derived from them.
Please report vulnerabilities privately, see SECURITY.md.
CalCraft is licensed under the GNU Affero General Public License v3.0 or later.







