astrid-runtime/astrid · error

FSKit lease manifest exceeds the bounded size

Error message

FSKit lease manifest exceeds the bounded size

What it means

validate_lease reads lease.json from the resource_path and enforces a 64 KiB size bound before parsing. The manifest is kernel-authored and small by contract, so an oversized file indicates corruption or tampering and is rejected before JSON decoding.

Source

Thrown at crates/astrid-storage-provider-fskit/src/service.rs:172

        bail!("FSKit lease paths must be absolute");
    }
    #[cfg(target_os = "macos")]
    astrid_core::fskit_socket::validate_callback_path(lease.mount_id, &lease.callback_path)
        .map_err(anyhow::Error::msg)?;
    #[cfg(not(target_os = "macos"))]
    if lease.callback_path != lease.resource_path.join("control.sock") {
        bail!("FSKit callback path is not the kernel lease endpoint");
    }
    platform_fs::validate_private_directory(&lease.resource_path)
        .context("validate private FSKit lease resource")?;
    platform_fs::verify_no_redirects(&lease.resource_path)
        .context("reject redirected FSKit lease resource")?;
    platform_fs::validate_private_file(&lease.resource_path.join("lease.json"))
        .context("validate private FSKit lease manifest")?;
    let manifest = std::fs::read(lease.resource_path.join("lease.json"))
        .context("read FSKit lease manifest")?;
    if manifest.len() > 64 * 1024 {
        bail!("FSKit lease manifest exceeds the bounded size");
    }
    let admitted: astrid_core::storage_filesystem::StorageMountLeaseV1 =
        serde_json::from_slice(&manifest).context("decode FSKit lease manifest")?;
    if admitted != *lease {
        bail!("FSKit launch lease does not match the kernel manifest");
    }
    Ok(())
}

fn validate_control_path(control_path: &Path, resource_path: &Path) -> Result<()> {
    if !control_path.is_absolute()
        || control_path
            .components()
            .any(|component| matches!(component, std::path::Component::ParentDir))
    {
        bail!("FSKit service control path is malformed");
    }
    let parent = control_path

View on GitHub (pinned to affd8760f4)

Solutions

  1. Restore the genuine kernel-written lease.json (small, <64 KiB) at resource_path
  2. Re-issue the lease so a fresh manifest is written
  3. Investigate what wrote to the resource directory; it must remain private and kernel-managed
Defensive patterns

Strategy: validation

Validate before calling

fn manifest_size_ok(resource: &std::path::Path) -> std::io::Result<bool> {
    Ok(std::fs::metadata(resource.join("lease.json"))?.len() <= 64 * 1024)
}

Try / catch

match std::fs::metadata(resource.join("lease.json")) {
    Ok(m) if m.len() > 64 * 1024 => return Err(anyhow!("lease manifest too large")),
    _ => {}
}

Prevention

When it happens

Trigger: std::fs::read of resource_path/lease.json returns more than 65536 bytes when validate_lease runs (via validate_launch or live_managed_callback_lease_is_accepted).

Common situations: lease.json accidentally concatenated or appended to by a script; a symlink swapped to a large file; corrupted disk content; adversarial injection into the lease directory.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/86590257e6fcfd3c. Report an issue: GitHub.