Formal Verification

Mathematically Verified by LeanRust & Lean 4.35.0

Every security-critical decision in HottubHTTP — DocumentRoot traversal confinement, URI byte filtering, HTTP/1.1 anti-smuggling framing, chunked transfer bounds, mod_authz_core access control, MPM worker bounds, byte-range clamping, keep-alive limits, and mod_status secret isolation — executes through Rust functions extracted to Lean 4 and checked directly by the Lean 4.35.0 kernel.

Certificate Status CERTIFIED · 0 sorry
Lean Kernel lean4:v4.35.0
Theorems Proved 27 Total Proofs
Fingerprint fnv1a64:df3461b7e0fb430e

Certified Kernels in hottubhttp-proof

12 LeanRust functional specifications + 5 Confidentiality & Integrity Noninterference proofs, re-verifiable locally with cargo xtask prove.

FunctionClass of Bug EliminatedVerified Properties
path_step & path_access_allowedCVE-2021-41773 path traversal & root escape10 #[ensures] + Confidentiality & Integrity Noninterference
uri_byte_safeNUL / CRLF / backslash URI injection (u8)6 #[ensures] + Confidentiality & Integrity Noninterference
framing_policy_checkRFC 9112 CL+TE HTTP request smuggling (u16)6 #[ensures] (400 / 413 / 431 bounds)
chunk_budget_stepChunked transfer body overflow4 #[ensures] (compound arithmetic guard)
authz_evaluatemod_authz_core Require bypass8 #[ensures] (immutable secret realm key)
public_status_active_workersSecret TLS/HMAC key leak via /server-statusSpec + Confidentiality & Integrity Noninterference
mpm_acquire & mpm_releaseMaxRequestWorkers overflow & underflow10 #[ensures] + release Noninterference
range_window_validateCVE-2011-3192 Apache Range header DoS7 #[ensures] (0 ≤ start ≤ end < len)
keepalive_stepKeep-Alive connection exhaustion4 #[ensures] (served ≤ max_requests)
header_overhead_budgetHidden super-linear header allocationInductive O(n) loop proof + Noninterference

Standalone Lean 4 Algebraic & Never-Type (→ False) Proofs

  • HottubHttp.PathSafety.normalize_isCanonical — Every accepted URI path contains zero ., zero .., and zero empty segments.
  • HottubHttp.PathSafety.normalize_rejects_leading_dotDot & no_leading_escape_accepted : ... → False — Curry–Howard impossibility theorem proving no leading .. escape is ever accepted.
  • HottubHttp.PathSafety.normalize_idempotent & normalize_length_le — Normalization is idempotent and never increases segment depth.
  • HottubHttp.Framing.rejects_cl_and_te, rejects_conflicting_cl & no_cl_te_smuggling_accepted : ... → False — Curry–Howard impossibility theorem proving CL+TE smuggling can never yield HTTP 200.
  • HottubHttp.Framing.scanToLf_le_size & scanToLf_ge_pos — Zero-copy line scanner terminates strictly within buffer bounds.

Rust Never Type (! / Infallible) & Curry–Howard Correspondence

In #![forbid(unsafe_code)] Rust, uninhabited types (! and core::convert::Infallible) are the type-level counterpart of Lean 4's empty proposition False. HottubHTTP uses them in crates/hottubhttp-core/src/never.rs and crates/hottubhttp-server/src/server.rs:

  • Zero-discriminant infallible VFS: MemoryVfs::Error = Never with compile-time const assert!(size_of::<Result<u64, Never>>() == size_of::<u64>()) and panic-free unwrap_infallible() (eliminating dead error branches and panic strings in both native and WASM builds).
  • Diverging server loops (→ !): accept_loop(...) -> ! and worker_loop(...) -> ! prove statically at compile time that TCP acceptor and worker threads never silently exit.
  • Cold diverging invariant helpers (→ !): Marked #[cold] #[inline(never)] so LLVM keeps failure blocks completely off the hot instruction cache lines.

Trusted Computing Base (Honest Boundaries)

The proof covers the Lean 4.35.0 kernel, LeanRust.Soundness, the extracted model in target/leanrust/Prove.lean, and all #[ensures] and standalone Lean 4 theorems. It does not claim to verify rustc/LLVM codegen, OS kernel syscalls, hardware, or wall-clock timing side channels.