Reference
Security
This page checks each security requirement of PRD §12 against the code and the tests that hold it.
Report a vulnerability privately to the repository owner rather than in a public issue.
| Requirement | How Davloom meets it | Held by |
|---|---|---|
| Private buckets by default | The Durable Objects backend has no public address. Davloom creates S3 buckets with no ACL, which makes them private, and R2 buckets are private unless their owner publishes them. Davloom reads and writes buckets only with credentials it keeps. | apps/api/src/instance.bun.ts (ensureDefaultBucket) |
| WebDAV over HTTPS only | Workers serve HTTPS. Over plain HTTP, WebDAV and the API answer only requests from the machine itself, or behind a proxy that sends X-Forwarded-Proto: https, unless DAVLOOM_ALLOW_HTTP=1 allows a trusted network. Anything else gets 403. A proxy that serves plain HTTP to other machines and forwards to localhost would defeat the check, so a proxy must serve HTTPS (docs/deployment/docker.md). | apps/api/src/app.ts (isInsecure); the HTTPS table in apps/api/src/app.test.ts |
| All file access is authorized | Every WebDAV request needs an API Key over Basic Auth, or the Dashboard's session with its marker header. The policy decides from the key's access level and scope, for the target and for the destination of COPY and MOVE. | The laws authorize_matches_spec, read_only_never_writes, denied_outside_scope and the four scope_* laws; the permission table of 480 cases (packages/webdav/src/tables/permissions.test.ts), which compat runs on Workers and Bun |
| Secrets in platform secrets or encrypted | DAVLOOM_SECRET comes from Workers secrets or the environment. S3 secret keys are stored sealed with AES-256-GCM under a key derived from DAVLOOM_SECRET, bound to their backend. Exports are encrypted under a random key shown once. | packages/core/src/credentials.ts, packages/core/src/archive.ts and their tests |
| API Keys not kept in plaintext | Better Auth stores only the key's SHA-256, and Davloom looks keys up by that hash. The key is shown once, when it is created. | hashApiKey in packages/core/src/instance.ts; apikey.key in packages/database/src/schema.ts |
| One owner, registered once | Registration is open only while the instance has no account, and closes for good once the owner exists. A SQLite trigger in migration 0005_accounts.sql refuses a second row in user, so two visitors registering at once cannot both win, on D1 and on Bun SQLite alike. An import takes the place of registration only with exactly one user who signs in with a password (the law import_needs_one_owner), and registration never adopts a backend or Mount that existed before the owner. The optional DAVLOOM_SETUP_TOKEN makes registration and import ask for a token, compared in constant time. Better Auth's own sign-up path is disabled. | packages/auth/src/identity.test.ts (concurrent registration), apps/api/src/app.test.ts, packages/core/src/instance.test.ts, packages/core/src/archive.test.ts, packages/database/src/repositories.test.ts |
| Strong passwords | Better Auth refuses passwords shorter than 12 characters, and its Have I Been Pwned plugin refuses passwords in known breaches on registration and on change, sending only five characters of the SHA-1 hash. When that API cannot be reached the password is refused with password_check_failed (503); DAVLOOM_CHECK_LEAKED_PASSWORDS=off turns the check off for an offline instance. | packages/auth/src/identity.test.ts |
| Step-up for sensitive actions | apps/api/src/verification.ts classifies every route as needing nothing, a confirmation or a step-up, and the API refuses an unclassified route with 404. A step-up action answers 403 verification_required unless the session signed in or verified again within 5 minutes, by password, plus the authenticator code when two-step verification is on, or by passkey. The decision is the Bend module verification.bend with its laws. | The U.* laws in LAWS.bend, packages/laws/src/verification.test.ts, apps/api/src/app.test.ts |
| Attempts are limited | Better Auth's rate limit is on in every environment and counts in the database, which every Worker isolate and Bun process shares, by the client's address: the one Cloudflare saw, or on Bun the socket's peer, or behind a proxy that DAVLOOM_TRUSTED_PROXIES names the nearest X-Forwarded-For address that is no trusted proxy (the laws forwarding_*). Re-verification, and an authenticator code a signed-in session sends, lock for 15 minutes after five wrong attempts per user, counted before each is checked in Davloom's own table verification_attempts, which nothing of Better Auth's prunes; a success clears the count. | packages/auth/src/identity.test.ts, apps/api/src/client-address.bun.test.ts, packages/laws/src/forwarding.test.ts, tests/integration/compat/http/auth-guards.test.ts |
| No cross-site changes | An /api request that changes something must carry JSON and come from the instance's origin: DAVLOOM_URL when it is set, else the address the request was sent to, as Origin or, without it, Sec-Fetch-Site: same-origin says. Anything else answers 403 cross_site or 415. The Dashboard's WebDAV requests carry a header a cross-site page cannot send without a preflight. | apps/api/src/same-origin.test.ts, apps/api/src/app.test.ts, tests/integration/compat/http/auth-guards.test.ts |
| Passkeys bound to the configured address | Passkeys take their relying party and origin from DAVLOOM_URL alone, never from a request's Host, and are off without it. | packages/auth/src/identity.test.ts, apps/api/src/instance.bun.test.ts |
| Path traversal | Paths are decoded once, per segment. A name is refused when it is empty, . or .., holds /, NUL or a lone surrogate, or runs past 255 bytes, and a path past 900 bytes is refused. A Mount resolves only inside its root, and a scoped key reaches nothing outside its roots. | The laws name_rejects_dots, name_rejects_separators, name_bounded, path_bounded, name_accepted and scope_outside_denied; packages/webdav/src/tables/traversal.test.ts |
| XML body size and complexity | Request bodies parse with saxes, which expands no entities but the five predefined ones and fetches nothing. A document type declaration is refused, and so is a body over 1 MiB, nested deeper than 64 or holding more than 20,000 elements. | packages/webdav/src/xml.ts; packages/webdav/src/tables/xml-bodies.test.ts |
| Recursive operations | PROPFIND with Depth: infinity on a collection answers 403 propfind-finite-depth. A COPY or MOVE touches at most a fixed number of entries, and over that limit it changes nothing. Uploads stop at the largest file size, and XML bodies at the limits above. | The law limit_exact; packages/storage/src/move-recovery.test.ts; packages/webdav/src/tables/propfind.test.ts |
| Conditional requests | GET, HEAD, PUT and the other methods evaluate If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since and If-Range in RFC 9110 order, and the If header with lock tokens and entity tags. | The laws preconditions_in_rfc_order and the range_* laws; entity-tags.test.ts, if-header.test.ts and range.test.ts in packages/webdav/src/tables |
| No sensitive authentication content in logs | Davloom logs errors without request headers, keys, cookies or secrets: credential errors carry no secret by construction, and an error from the database, whose message can name the values a query was bound to, is logged by its class and code alone (redactedError in packages/core/src/redact.ts). Better Auth's log goes through the same redaction, and an error its router would print whole is caught and logged the same way. | packages/core/src/credentials.ts (CredentialsError); packages/core/src/redact.test.ts; packages/auth/src/auth.test.ts; tests/integration/compat/http/log-redaction.test.ts, including an import the database refuses and a failing session table under Better Auth |
| Cross-Mount operations denied | A COPY or MOVE between two backends is refused with 502. A scoped key's destination must lie inside its roots. | The law scope_destination_inside; the cross-backend cases of the storage and permission tests |
| Rules proven in Bend 2 | Every decision above that takes no IO is compiled from Bend, and packages/laws/LAWS.bend states its laws. Both bend PROOF.bend and bend PROOF.bend --verdict print ALL PROOFS CHECK for all 74 laws, in CI on every pull request. | the laws job of .github/workflows/ci.yml; bun run laws:check |
Step-up verification
Every route of the API needs an entry in
API_ACTIONS in apps/api/src/verification.ts, which
names the route's effect: read, change, end-self, destroy, credential or disclose, or public for a route that serves
visitors without a session.
verificationLevel in @davloom/laws turns the effect into a level: none for reads and
ordinary changes, confirm for ending one's own session, and step-up for destroying data,
changing a credential and disclosing records. A route without an entry answers 404, and
app.test.ts fails for it. Better Auth paths go in AUTH_ACTIONS, and the Dashboard's WebDAV
requests are classified by method in davEffect: a PUT is destroy unless it sends
If-None-Match: *, which only creates a file, and the Dashboard's upload sends it first.The Dashboard needs nothing extra for a new step-up route:
apiCall, authFetch and the WebDAV requests in
apps/web/src/features/api/ catch 403 verification_required, open the shared "Verify it is
you" dialog, and send the request again once the person verified. A confirm action asks with
an AlertDialog before it sends, as useSignOut does.Supply chain and repository
- OSV-Scanner checks every package in
bun.lockon each pull request and every week. Each exception inosv-scanner.tomlgives its reason and an expiry date (docs/ci.md). - Gitleaks scans each pull request's commits for secrets. CodeQL analyses the TypeScript, and actionlint and zizmor check the workflows.
- Dependencies are pinned to exact versions, and actions to full commit SHAs.
- No known Critical vulnerability is open: on the day of this check, the dependency scan reports none, and no exception covers one.
PreviousManagement API
On this page