{"record":{"id":"1bd2776d58f52600","repo":"gitbutlerapp/gitbutler","slug":"signature-verification-failed-the-download-may-h","errorCode":null,"errorMessage":"Signature verification failed - the download may have been tampered with: {e}","messagePattern":"Signature verification failed - the download may have been tampered with: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/but-installer/src/install.rs","lineNumber":88,"sourceCode":"    let mut file =\n        File::open(installable).context(\"Failed to open installable for verification\")?;\n    let mut verifier = public_key\n        .verify_stream(&signature)\n        .map_err(|e| anyhow!(\"Failed to initialize signature verifier: {e}\"))?;\n\n    // Read and verify file in 64KB chunks\n    let mut buffer = [0u8; 65536];\n    loop {\n        let bytes_read = file.read(&mut buffer)?;\n        if bytes_read == 0 {\n            break;\n        }\n        verifier.update(&buffer[..bytes_read]);\n    }\n\n    // Finalize verification\n    verifier.finalize().map_err(|e| {\n        anyhow!(\"Signature verification failed - the download may have been tampered with: {e}\")\n    })?;\n\n    ui::info(\"Signature verification passed\");\n    Ok(())\n}\n\n#[cfg(test)]\nmod tests {\n    use std::io::Write;\n\n    use super::*;\n\n    #[test]\n    fn test_verify_signature_empty() {\n        let temp_dir = tempfile::tempdir().unwrap();\n        let test_file = temp_dir.path().join(\"test.tar.gz\");\n\n        // Create a dummy file","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/install.rs#L70-L106","documentation":"verify_signature() streams the downloaded installable through the signature verifier and calls finalize() at the end. This error means the artifact's content does not match its signature — the download is corrupt or was tampered with — so installation is aborted as a security measure.","triggerScenarios":"download_and_install_app → verify_signature when verifier.finalize() fails: the downloaded binary differs from what the release was signed over (corruption, truncation, or a man-in-the-middle substitution).","commonSituations":"Interrupted or truncated downloads; disk corruption in the temp file; compromised mirror or MITM replacing the payload; downloading from a stale cache that mixed versions.","solutions":["Delete the temp file and re-download the artifact","Verify network integrity (avoid untrusted mirrors/proxies)","If persistent, confirm the release on the server was signed with the embedded public key (release-side problem)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify size sanity after download\nlet meta = std::fs::metadata(&file)?;\nanyhow::ensure!(meta.len() > 0, \"downloaded artifact is empty\");","typeGuard":null,"tryCatchPattern":"match verify_signature(&file, &sig, &dir) {\n    Ok(()) => install(),\n    Err(e) if e.to_string().contains(\"tampered with\") => {\n        eprintln!(\"Integrity check failed — deleting and re-downloading\");\n        std::fs::remove_file(&file)?;\n        download_and_install_app(...)?; // one re-download attempt\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always re-download on verification failure; never force-install","Download over TLS from official domains only","Compare expected asset size/checksum when the release provides one"],"tags":["signature","security","integrity","download"],"backgroundTag":"checksum-mismatch","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}