gitbutlerapp/gitbutler · critical

Signature verification failed - the download may have been…

Error message

Signature verification failed - the download may have been tampered with: {e}

What it means

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.

Solutions

  1. Delete the temp file and re-download the artifact
  2. Verify network integrity (avoid untrusted mirrors/proxies)
  3. If persistent, confirm the release on the server was signed with the embedded public key (release-side problem)
Defensive patterns

Strategy: retry

Validate before calling

// verify size sanity after download
let meta = std::fs::metadata(&file)?;
anyhow::ensure!(meta.len() > 0, "downloaded artifact is empty");

Try / catch

match verify_signature(&file, &sig, &dir) {
    Ok(()) => install(),
    Err(e) if e.to_string().contains("tampered with") => {
        eprintln!("Integrity check failed — deleting and re-downloading");
        std::fs::remove_file(&file)?;
        download_and_install_app(...)?; // one re-download attempt
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/1bd2776d58f52600. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-installer/src/install.rs:88

    let mut file =
        File::open(installable).context("Failed to open installable for verification")?;
    let mut verifier = public_key
        .verify_stream(&signature)
        .map_err(|e| anyhow!("Failed to initialize signature verifier: {e}"))?;

    // Read and verify file in 64KB chunks
    let mut buffer = [0u8; 65536];
    loop {
        let bytes_read = file.read(&mut buffer)?;
        if bytes_read == 0 {
            break;
        }
        verifier.update(&buffer[..bytes_read]);
    }

    // Finalize verification
    verifier.finalize().map_err(|e| {
        anyhow!("Signature verification failed - the download may have been tampered with: {e}")
    })?;

    ui::info("Signature verification passed");
    Ok(())
}

#[cfg(test)]
mod tests {
    use std::io::Write;

    use super::*;

    #[test]
    fn test_verify_signature_empty() {
        let temp_dir = tempfile::tempdir().unwrap();
        let test_file = temp_dir.path().join("test.tar.gz");

        // Create a dummy file

View on GitHub (pinned to 58e5313667)