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.
Certified Kernels in hottubhttp-proof
12 LeanRust functional specifications + 5 Confidentiality & Integrity Noninterference proofs, re-verifiable locally with cargo xtask prove.
| Function | Class of Bug Eliminated | Verified Properties |
|---|---|---|
path_step & path_access_allowed | CVE-2021-41773 path traversal & root escape | 10 #[ensures] + Confidentiality & Integrity Noninterference |
uri_byte_safe | NUL / CRLF / backslash URI injection (u8) | 6 #[ensures] + Confidentiality & Integrity Noninterference |
framing_policy_check | RFC 9112 CL+TE HTTP request smuggling (u16) | 6 #[ensures] (400 / 413 / 431 bounds) |
chunk_budget_step | Chunked transfer body overflow | 4 #[ensures] (compound arithmetic guard) |
authz_evaluate | mod_authz_core Require bypass | 8 #[ensures] (immutable secret realm key) |
public_status_active_workers | Secret TLS/HMAC key leak via /server-status | Spec + Confidentiality & Integrity Noninterference |
mpm_acquire & mpm_release | MaxRequestWorkers overflow & underflow | 10 #[ensures] + release Noninterference |
range_window_validate | CVE-2011-3192 Apache Range header DoS | 7 #[ensures] (0 ≤ start ≤ end < len) |
keepalive_step | Keep-Alive connection exhaustion | 4 #[ensures] (served ≤ max_requests) |
header_overhead_budget | Hidden super-linear header allocation | Inductive 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 = Neverwith compile-timeconst assert!(size_of::<Result<u64, Never>>() == size_of::<u64>())and panic-freeunwrap_infallible()(eliminating dead error branches and panic strings in both native and WASM builds). - Diverging server loops (
→ !):accept_loop(...) -> !andworker_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.