From df9f7fea845eecf1ec5e76731306bc8218cf1861 Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 18 Nov 2026 13:00:29 +0800 Subject: [PATCH] security(lean): reject modified goal module during kernel invocation --- src/prove/driver.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/prove/driver.rs b/src/prove/driver.rs index 461263c..7c9abc5 100755 --- a/src/prove/driver.rs +++ b/src/prove/driver.rs @@ -126,9 +126,12 @@ pub fn ensure_library(cache_root: &Path, lean: &Toolchain) -> Result<(PathBuf, S pub fn check_closed_goals( toolchain:&Toolchain, source:&Path, timeout:Duration )->Result<()>{ + let source_before=std::fs::read(source)?; let mut command=Command::new(&toolchain.lean); command.arg(source); let (log,code,timed_out)=run_with_timeout(&mut command,timeout)?; + anyhow::ensure!(std::fs::read(source)?==source_before, + "proof.modular_source_race: Lean goal module changed during verification"); anyhow::ensure!(!timed_out, "proof.modular_timeout: Lean did not finish within {}s",timeout.as_secs()); anyhow::ensure!(code==Some(0),