{"record":{"id":"90c35f8f5a7173c3","repo":"gitbutlerapp/gitbutler","slug":"signature-is-empty-refusing-to-verify-without-a","errorCode":null,"errorMessage":"Signature is empty - refusing to verify without a valid signature","messagePattern":"Signature is empty - refusing to verify without a valid signature","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/but-installer/src/install.rs","lineNumber":40,"sourceCode":"        .arg(\"--version\")\n        .stdout(Stdio::null())\n        .stderr(Stdio::null())\n        .status()\n        .map(|s| s.success())\n        .unwrap_or(false)\n}\n\n/// Verify the signature for a CLI installable\npub(crate) fn verify_signature(\n    installable: &Path,\n    signature_b64: &str,\n    temp_dir: &Path,\n) -> Result<()> {\n    crate::ui::info(\"Verifying download signature...\");\n\n    // Validate signature is not empty - this is a security requirement\n    if signature_b64.trim().is_empty() {\n        bail!(\"Signature is empty - refusing to verify without a valid signature\");\n    }\n\n    // GitButler's minisign public key\n    let pubkey_str = \"RWTrOEI+im1XYA9RBwyxnzFN/evFzJhU1lbQ70LVayWH3WRo7xQnRLD2\";\n\n    // Parse the public key\n    let public_key = minisign_verify::PublicKey::from_base64(pubkey_str)\n        .context(\"Failed to parse public key\")?;\n\n    // Decode signature from base64 and write to file\n    // The signature format from the API is base64-encoded minisign signature file content\n    use base64::{Engine, engine::general_purpose::STANDARD};\n    let signature_bytes = STANDARD\n        .decode(signature_b64)\n        .context(\"Failed to decode signature from base64\")?;\n\n    // Write signature to temp file for minisign to parse\n    let signature_file = temp_dir.join(\"signature.minisig\");","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/install.rs#L22-L58","documentation":"`verify_signature` refuses to run minisign verification when the base64 signature string is empty or whitespace-only. This is a deliberate security guard: verifying with an empty signature could never succeed, and proceeding would hide a tampered/missing signature file from the caller.","triggerScenarios":"The signature file downloaded alongside the artifact was empty (server returned an error page or empty body), a placeholder/nil signature was passed programmatically, or the signature URL 404'd into an empty string upstream.","commonSituations":"Release infrastructure uploaded the binary without its .minisign signature; a mirror serves an empty signature; custom install flows that fetch the signature themselves and pass \"\" on failure.","solutions":["Re-run the install — an empty signature usually means a failed/partial download of the signature file.","Verify the signature file exists and is non-empty at the source URL for your version/platform.","Check release infrastructure status; if the signature is genuinely missing upstream, wait for it to be republished and do not bypass verification.","If you drive the API directly, validate the signature string is non-empty before calling verify_signature."],"exampleFix":"// before\nverify_signature(&data, &signature /* may be \"\" */, &tmp)?;\n// after\nif signature.trim().is_empty() {\n    anyhow::bail!(\"signature file missing or empty; refusing to install\");\n}\nverify_signature(&data, &signature, &tmp)?;","handlingStrategy":"validation","validationCode":"fn signature_looks_valid(sig: &str) -> bool {\n    let s = sig.trim();\n    !s.is_empty()\n        && s.len() >= 100  // minisign signatures are ~300+ chars base64\n        && s.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'+' || b == b'/' || b == b'=' || b == b'\\n' || b == b'\\r')\n}","typeGuard":null,"tryCatchPattern":"if signature.trim().is_empty() {\n    anyhow::bail!(\"signature missing — aborting install (possible tampering or failed signature download)\");\n}\nverify_signature(&artifact, &signature, &tmp)\n    .context(\"signature verification failed; refusing to install\")?;","preventionTips":["Never bypass or stub out signature verification in automated installs.","After fetching the signature file, assert it is non-empty and base64-shaped before verifying.","If the signature download failed, abort the whole install rather than continuing with an empty value.","Alert on empty signatures — they usually indicate broken release infrastructure or a tampered download path."],"tags":["security","signature","verification","download"],"backgroundTag":"empty-required-field","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"}