TOSV security measures: index
Every security measure ever specified for TOSV, collected from the full
text sweep of 2026-10-31: tosv.cpp, tosv.cpp.bak, archive/tosv.py
legacy plus legacy README, ARCHITECTURE.md, README_TOSV.md,
plan.md, prompt.md, uploads/paste.txt, pdf/931edaee4c9e/source.md
elite report, tasks/4ef6d085742c research notes plus report, live
SPEC.md, AGENTS.md, tosv.AGENTS.md. Vendored wolfssl and wolfssh
trees are reference only and out of scope. Secret values are never
printed here; formats use placeholders.
Status legend: SHIPPED (in C++ port today), SPEC (pinned in SPEC.md, fix lands in M1-M4), LEGACY (Python port only, superseded), PLAN (approved direction for v2, needs ADR).
SPEC.md stays canonical. These pages are deep-dive mirrors: they explain, they never override. On conflict the spec wins.
Map
| # | Measure | Status | Spec | Page |
|---|---|---|---|---|
| 1 | One-time bootstrap, plaintext by design | SHIPPED | FR-01 | sec-bootstrap |
| 2 | Per-grant random creds plus UUID | SHIPPED | FR-03, SEC-04 | sec-grant-creds |
| 3 | Duress login plus vault wipe | SHIPPED | FR-08 | sec-duress |
| 4 | Layered crypt plus KDF chain (v1 legacy) | LEGACY | SEC-01, SEC-02, SEC-03 | sec-layers |
| 5 | Memory hygiene, wipe, never whole key | SHIPPED | SEC-02, NFR-03 | sec-memory |
| 6 | 64KB streaming, never whole file in RAM | SHIPPED | FR-06, NFR-03 | sec-streaming |
| 7 | IP allowlist plus CIDR gating | SHIPPED | SEC-05 | sec-ip-gate |
| 8 | Time-window gating | SHIPPED | SEC-06 | sec-time-window |
| 9 | Rate limits, no wipe on failures | SHIPPED | FR-10 | sec-rate-limit |
| 10 | Minimal audit log | SHIPPED | FR-11 | sec-audit |
| 11 | Atomic DB, escaping, clamping | SHIPPED | FR-12 | sec-db |
| 12 | Sessions plus Basic auth parsing | SHIPPED | SEC-07 | sec-session |
| 13 | Loopback plus stunnel, TLS research | SHIPPED | SEC-08, OPS-01 | sec-transport |
| 14 | WebDAV hardening | SHIPPED | FR-09 | sec-dav |
| 15 | Append-only default, two-way policy | SHIPPED | FR-02, FR-03 | sec-modes |
| 16 | Input caps plus shutdown behavior | SHIPPED | caps, D-04 | sec-caps |
| 17 | Custom UUIDv4 plus random generation | SHIPPED | SEC-04, PIN-09 | sec-uuid |
| 18 | Shipped crypto: AEAD, Argon2 (X25519 future) | SHIPPED | D-08, D-18, D-19 | sec-future-crypto |
| 19 | Future platform: lock, TPM, NTP, VFS | PLAN | - | sec-future-platform |
| 20 | Future netops: SFTP, TLS libs, monitor | PLAN | NG-01, D-06 | sec-future-netops |
| 21 | Integrity sidecars | SHIPPED | FR-13, D-13 | sec-integrity |
| 22 | Clock skew guard | SHIPPED | FR-14, D-14 | sec-clock |
Per-method reasoning, pros, cons
1. One-time bootstrap
Reasoning: first contact needs trust without shipped secrets, so the binary mints its own admin pass on first run and burns it on first use. Theft of the file later buys nothing. Pros: no default password; self-provisioning; single-use kills replay. Cons: plaintext at rest before burn (resolved by loopback-only first run plus immediate burn, see transport); operator may lose the pass before use (resolved by bootstrap recovery runbook in M4).
2. Per-grant random credentials
Reasoning: every fetch grant is its own unguessable identity, so one leak never opens another grant and revocation is one line. Pros: 128-plus-bit search space; per-grant IP plus window binding; cheap rotation by re-issue. Cons: creds shown once on screen (resolved by minimal audit plus short windows); operator may screenshot them (residual: operator discipline).
3. Duress wipe
Reasoning: coercion is a real threat model for vaults, so a second login exists whose only job is authenticated destruction with proof. Pros: works under pressure; audited before wipe; covers blobs plus DB. Cons: typo could wipe (resolved by 24-plus random chars, never typed by hand in normal flow); SSD wear leveling keeps ghosts (residual, see future crypto keyslot shredding).
4. Layered crypt plus KDF (v1 legacy)
Reasoning: depth buys time; chaining each layer key through the legacy hash of auth plus previous key binds ciphertext to creds. Pros: 1-8 tunable layers; wrong creds give garbage, not errors to oracle on; no key stored anywhere. Cons: XOR is malleable, no integrity tag (resolved for new blobs by shipped AEAD); leg-hash-XOR is nonstandard and failed known-answer test (frozen for legacy read only, D-19).
5. Memory hygiene
Reasoning: RAM is shared with other software, so key bytes are wiped
after use and full keys are never held as one value longer than a
chunk step.
Pros: tiny exposure window; no keys in logs or dumps by construction.
Cons: wipe_mem currently unused, raw memset used (fix in M2);
volatile wipe is compiler-fragile (resolved in v2 by RAII locked
buffers, see future platform).
6. Streaming
Reasoning: vault files can exceed RAM, so crypt walks 64KB chunks and memory stays flat. Pros: unbounded file size in bounded RAM; doubles as DoS cap. Cons: legacy fetch loaded whole blobs (fix mandated by FR-06 in M2); chunk loop must keep offset math exact (covered by Gate 2 plus the streaming page).
7. IP gating
Reasoning: stolen creds alone should not open the vault, so each grant carries its own IP or CIDR list checked per request. Pros: per-grant, no global firewall needed; CIDR covers ranges. Cons: IP spoofing on open networks (resolved by loopback plus stunnel plus short windows, see transport); NAT and DHCP churn can lock out legit fetchers (resolved by CIDR ranges).
8. Time windows
Reasoning: access should die on its own, so grants carry from and to bounds compared in UTC. Pros: self-expiring; empty bound means open, no clock games needed. Cons: VM clock skew shifts bounds (resolved in v2 by NTP guard, see future platform); coarse minute granularity (accepted: finer buys nothing for vault use).
9. Rate limits
Reasoning: guessing must be slow, so login and store are capped per IP with 429 beyond. Pros: kills online brute force; in-memory, zero config. Cons: caps reset on restart (resolved by low caps plus strong creds, restart wipes attacker progress too); no fail2ban block yet (resolved by caps plus short windows; block list is a follow-up).
10. Minimal audit
Reasoning: forensics without a treasure map, so the log holds time, IP, action, id, never secrets or content. Pros: breach review safe to share; append-only line format. Cons: 100MB cap needs external rotation (resolved by OPS-02 plus restore drill); no HMAC chain yet (resolved in v2 journal, see future platform).
11. Atomic DB
Reasoning: a torn write must never corrupt the grant store, so saves go tmp plus rename with escaping and clamping. Pros: crash-safe; clamping kills layer overflow; escaping kills line injection. Cons: whole-DB rewrite per grant (fine under 10k cap, see caps); concurrent grants need mutex discipline (covered by Gate 2 hammer test).
12. Sessions plus Basic
Reasoning: wizard needs clicks, APIs need headers, so cookie sessions serve humans and Basic serves machines. Pros: HttpOnly cookies; Basic decode skips garbage to deny. Cons: Basic over plaintext loopback only (resolved by loopback pin plus stunnel for remote, see transport); 1000-session cap drops oldest (accepted: single operator).
13. Transport
Reasoning: the binary stays small and correct by doing zero TLS itself and binding loopback, with stunnel in front for remote. Pros: zero TLS bugs in binary; stunnel is battle-tested; research pins mbedTLS default for later in-binary TLS. Cons: plaintext on loopback visible to local root (accepted: local root already owns the process); remote needs extra setup (resolved by stunnel runbook in M4).
14. WebDAV
Reasoning: drives speak WebDAV, so the vault serves class 1 in binary with the same grant auth plus IP gates. Pros: zero new deps; mounts as a drive; traversal stripped; XML escaped. Cons: legacy PUT stored plaintext (fix mandated: crypt like FR-04); LOCK is a stub token (accepted for class 1 database use, real leases in future platform).
15. Modes
Reasoning: most drops must be write-once, so append-only is default and two-way drive use is an explicit checkbox with its own policy. Pros: accidents and ransomware cannot overwrite by default; policy (LWW, 30d history, oplocks, 128MB cache, TLS) is pre-decided. Cons: two-way widens the surface (resolved by explicit opt-in plus audit); WORM enforced by convention in v1 (resolved per-protocol in future netops).
16. Caps plus shutdown
Reasoning: everything unbounded gets a ceiling and shutdown must be boring, so headers, blobs, grants, sessions are capped and signals close without wiping. Pros: DoS surface is finite; routine restarts never delete. Cons: legacy wiped on signals (changed by D-04 with rationale: floors page humans instead of auto-deleting); caps can reject legit large drops (resolved by documented 413 plus 512MB ceiling).
17. UUID plus random
Reasoning: IDs must be unguessable without a library that holds whole
secrets in helpers, so UUIDv4 and hex rand are hand-rolled on
random_device.
Pros: zero deps; RFC variant bits; no helper-held copies.
Cons: random_device quality varies by platform (resolved by Linux
x86_64 pin plus Gate 2 entropy smoke); hand-rolled means hand-audit
(resolved by 10-line reviewable code).
21. Integrity sidecars
Reasoning: corruption must fail loudly, so every blob carries a SHA256 tag verified before serve, with transparent backfill. Pros: zero new deps; no flag day; 500 plus audit on mismatch. Cons: unkeyed tags bow to malicious rewriters (resolved by scope: v2 AEAD proposed in ADR 0005 with trigger).
22. Clock skew guard
Reasoning: time travel must leave a line, so an hourly SNTP check audits skew past 60s without ever blocking. Pros: no dependency; cannot self-DoS; one env var to arm. Cons: spoofable replies forge lines (resolved by fail-open: false lines cost seconds of review, never a denied login).
18-20. Planned (v2)
AEAD plus Argon2 plus X25519 (page), platform hardening plus TPM plus NTP plus VFS (page), SFTP plus TLS libs plus monitoring (page). Each names its trigger ADR and the v1 stopgap that holds until then.