Skip to content
Repos

TOSV

Markdown 2.4 KB64 lines Opens in site

Directory Raw Download

IP allowlist plus CIDR gating

  • Status: SHIPPED in C++ port
  • Spec: SEC-05, FR-05, FR-09
  • Sources: tosv.cpp ip_ok, archive/tosv.py ip_ok, uploads/paste.txt vision, SPEC.md 3

What it is

Each grant carries its own comma-separated IP list with exact or CIDR entries (203.0.113.7, 198.51.100.0/24), checked on every fetch and WebDAV call against the peer address. Empty means open. The check runs after auth, so scanners learn nothing about the list.

How TOSV does it

ip_ok trims entries, splits CIDR on /, compares with inet_addr plus mask math on ntohl values, and falls back to string equality for bare IPs. Bad entries are skipped, never fatal. Fetch and dav_auth paths both call it before touching bytes.

What it protects against

Stolen-credential reuse from anywhere else on the internet: the most common real leak shape (forwarded mail, pasted chat) dies at the gate unless the attacker also sits on the named network.

Attack realism

High for targeted drops (office egress IP, home IP, VPN exit) and honest about its limits: IP is an attribute, not an identity. NAT, CGNAT, and DHCP churn make exact-IP grants brittle, which is why CIDR ranges and the empty-means-open escape exist.

Pros

Per-grant, no firewall tickets. CIDR covers offices and VPN exits. Fail-open on parse keeps one typo from bricking a grant.

Cons and how the vault resolves them

  • Spoofing on open networks. Resolved by layering: the gate is one of three factors (creds plus IP plus window), and loopback plus stunnel removes off-path spoofing for the realistic deploy.
  • NAT and DHCP churn lock out legit fetchers. Resolved by CIDR ranges as the documented default for humans, exact IPs only for servers with static egress.
  • No IPv6 CIDR math in v1. Closed in M5: full v4 plus v6 CIDR with a 26-vector harness cross-checked against python ipaddress.
  • List lives in the DB line. Resolved by the same reasoning as grant creds: DB readers already own everything; see grant creds.

Residual risk

On-path attacker inside the allowed range. Accepted: that attacker is inside the trust boundary the operator drew.

See also

39.5ms