Repository navigation
Closed
Labels
ready-for-agentTriage: ready for an agent to pick upTriage: ready for an agent to pick up
Description
Phase spec from the 2026-07-09 security audit map (#24). Closes audit High #1 (plaintext bearer tokens + repo traffic on sc+http://). Builds on P31 (its socket timeouts sit beneath the TLS wrap).
Locked decisions
From Decide: transport confidentiality for sc+http and Decide: sc+https:// cert/key provisioning & TOFU pinning UX (research: TLS & token-confidentiality options, docs/research/tls-options-sc-http.md):
sc+https://(the scheme ADR-0036 reserved) via rustls, ring provider (default-features = false; ~14 new crates measured; no cmake). Blockingrustls::Streamwrapped at the two seam functions (HttpTransport::connect_with_token,handle_http_connection); TLS sits below the HTTP opening — opening codec,serve_tokens, and all ofwire.rsunchanged;PROTOCOL_VERSIONstays 3; existingsc+http://remotes keep working. aws-lc-rs recorded in the ADR as the swap-in fallback provider.- New
crates/tlsioquarantine (the gix→gitio / RustCrypto→crypto precedent): the only crate linking rustls/rcgen; exposes client/server wrap-a-TcpStream constructors, the hand-written TOFUServerCertVerifier(~100 lines; the one pre-built pinning crate is five majors stale), and cert mint.repo → tlsiojoins the dependency rule; CLAUDE.md quarantine list updated. - Trust model: accept-new TOFU. Unknown host → pin silently, print the fingerprint loudly, proceed.
SC_HTTPS_FINGERPRINT=<spki-sha256>pre-pins (CI); strict mode refuses unknown hosts. Pin mismatch always hard-fails with a recovery hint — never a prompt. Pins in user-level~/.config/sc/known_hosts, one line perhost:port; pin = SHA-256 of the server SPKI (survives same-key cert renewal; openssl-verifiable). The verifier checks the key, deliberately ignoring names/validity (pin-only trust in v1). - Server lifecycle: explicit
--tlsper listener (sc serve --http <addr> --tls [--tls-cert <pem> --tls-key <pem>]); one port speaks one protocol. Without PEM, auto-mint via rcgen into persistent.sc/serve-tls/(cert.pem+key.pem, key 0600; the key IS the identity — regenerate only if missing; long validity). Fingerprint in the TLS serve startup banner + newsc serve fingerprintsubcommand. ACME rejected (async stack) — operators use certbot/proxies. - P29 gate tightening: once TLS exists, a configured token alone no longer justifies a non-loopback plaintext bind — public plaintext requires explicit
--allow-public(or--read-only); loopback unchanged. Deliberate, narrow pre-1.0 break. - Docs corrections ride along: the reverse-proxy guidance must document both legs (server-side TCP-mode termination — nginx
stream/ HAProxymode tcp/ stunnel — AND the client-side tunnel, absent today); promotessh://(ADR-0022) as the already-shipped confidential transport; rewrite the THREAT-MODEL transport section forsc+https://.
Non-goals
ACME in-binary; CA-path validation (later, additive for PEM deployments); non-bearer auth schemes (challenge-response/Ed25519 nonce-signing — rejected as interim measures on #26); Noise transport.
Acceptance criteria
- ADR required (first TLS dependency; the map's dep-rationale bar): why in-binary TLS is load-bearing for sc's client (reaches servers its operator doesn't control — the case Vaultwarden/Garage punt), ring-vs-aws-lc-rs, the tlsio quarantine.
- Tests: TOFU pin lifecycle (first-connect pin, mismatch hard-fail, pre-pin, strict), PEM path, plaintext-gate tightening, and a loopback sc+https:// round trip (clone + push + fetch) with a signed large blob under forced
SC_PACK_CHUNK, byte-for-byte, zero.sc/tmpresidue. - Demo script proving the TLS round trip + TOFU behavior + the tightened plaintext gate (the
run_http_auth_demo.shpattern), run twice. - CLAUDE.md: new commands/flags, dependency-rule and quarantine updates.
Part of the #24 audit-response map.
Metadata
Metadata
Assignees
Labels
ready-for-agentTriage: ready for an agent to pick upTriage: ready for an agent to pick up
Activity