SPB Git

Repository Public

SECURITY-REVIEW.md 3.5 KB 39 lines markdown

1# SP Drive 2.0 — security review (2026-11-19)23## Model (unchanged, stated accurately)4Encryption is **server-side at rest**: AES-256-GCM per object, keys wrapped by a master key held on the node. SP Drive is **not**5end-to-end encrypted. Passkeys (WebAuthn), device sessions (bearer), strict CSP, CSRF header rule, ClamAV quarantine, sandboxed converters.67## New exposure introduced by 2.0, and how it is bounded8| Change | Risk | Bound |9|---|---|---|10| Content index (`object_passages`) | extracted text is plaintext in PostgreSQL on the node | dump stays sealed in backups; `SPD_INDEX_CONTENT=off` + `purge-index`; documented in the threat model |11| Text helper (PDFKit/Vision) | hostile documents | `sandbox-exec`, no network, cannot read master key or blob store (tested); two extra allow rules limited to its model cache; page/char/pixel/time caps |12| Node-side extraction | regex/zip abuse | runs in a sandboxed child with a 60 s kill, linear scanner, 24 MB inflated cap |13| AI | documents leaving the node; prompt injection | local model by default; external providers need `SPD_AI_EXTERNAL=on` **and** the account flag (currently off); model has no tools, output is text; only retrieved passages are sent |14| Private sharing | cross-tenant access | separate `/shared/:grantId` route family; every call re-checks grant, grantee, subtree, trash; owner lock on revoke/downgrade |15| Event streams | resource exhaustion | 16 per account, 1000 global, session re-checked every 25 s, closed on shutdown |1617## Independent review (separate reviewer, read-only, before deployment)18No cross-tenant read or write hole: 28 cross-account attempts refused against the running API. Findings, all fixed in `0073557` with19regression tests (`services/api/test/next-hardening.test.ts`):201. **High** — a crafted HTML/Office file froze the worker for hours (quadratic regexes); reachable by anonymous portal depositors.212. **Medium** — a grantee saw the owner's full audit history of a shared folder and could turn a user id into an e-mail address.223. Low — stream cap race; 4. Low — rate-limit escape on refused upload chunks.235–14 (plausible, treated as real) — similar-images memory blow-up, semantic cache memory, unbounded helper spawns, uploader24name probing, revoke/downgrade races, quota reservation by a grantee, helper memory on pixel bombs, rollback leftovers,25`backup-verify --no-key` claiming a check it had not made, indexing under the wrong name.2627## Residual risks28- Revoke-vs-complete race is covered by a 12-round concurrent test, not a deterministic interleaving.29- The Anthropic/OpenAI/OpenRouter adapters were never run against the real services: test before enabling `SPD_AI_EXTERNAL`.30- The gateway (Caddy) access log still records public link tokens in URLs (known since 1.0).31- A LibreOffice copy lives at `/Users/Shared/sp-drive-tools/` (notarized binary, world-readable location): update it with LibreOffice.32- Backups: master key is in no backup set (verified on the off-node copy); losing the node **and** the laptop copy of the key loses the data.3334## Backups and recovery35Nightly sealed backup 03:40 (`status.json`, `manifest.tsv`), `backup-verify.sh`, `restore-test.sh` (39 objects re-hashed, OK).36Off-node: gateway LaunchDaemon `io.maclustr.sp-drive-offnode` (04:30) copies the sealed set m5ma → M2U6437`~/backups-offnode/sp-drive`, verifies it there without the key and reports `offnode.json` to the admin view. Rollback of the 2.038code: tag `pre-2.0`, build kept in `~/apps/sp-drive-dist-1.0`, SQL in `docs/runbooks/operations.md`.39
Files main
Menu

Theme