{"record":{"id":"86590257e6fcfd3c","repo":"astrid-runtime/astrid","slug":"fskit-lease-manifest-exceeds-the-bounded-size","errorCode":null,"errorMessage":"FSKit lease manifest exceeds the bounded size","messagePattern":"FSKit lease manifest exceeds the bounded size","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-fskit/src/service.rs","lineNumber":172,"sourceCode":"        bail!(\"FSKit lease paths must be absolute\");\n    }\n    #[cfg(target_os = \"macos\")]\n    astrid_core::fskit_socket::validate_callback_path(lease.mount_id, &lease.callback_path)\n        .map_err(anyhow::Error::msg)?;\n    #[cfg(not(target_os = \"macos\"))]\n    if lease.callback_path != lease.resource_path.join(\"control.sock\") {\n        bail!(\"FSKit callback path is not the kernel lease endpoint\");\n    }\n    platform_fs::validate_private_directory(&lease.resource_path)\n        .context(\"validate private FSKit lease resource\")?;\n    platform_fs::verify_no_redirects(&lease.resource_path)\n        .context(\"reject redirected FSKit lease resource\")?;\n    platform_fs::validate_private_file(&lease.resource_path.join(\"lease.json\"))\n        .context(\"validate private FSKit lease manifest\")?;\n    let manifest = std::fs::read(lease.resource_path.join(\"lease.json\"))\n        .context(\"read FSKit lease manifest\")?;\n    if manifest.len() > 64 * 1024 {\n        bail!(\"FSKit lease manifest exceeds the bounded size\");\n    }\n    let admitted: astrid_core::storage_filesystem::StorageMountLeaseV1 =\n        serde_json::from_slice(&manifest).context(\"decode FSKit lease manifest\")?;\n    if admitted != *lease {\n        bail!(\"FSKit launch lease does not match the kernel manifest\");\n    }\n    Ok(())\n}\n\nfn validate_control_path(control_path: &Path, resource_path: &Path) -> Result<()> {\n    if !control_path.is_absolute()\n        || control_path\n            .components()\n            .any(|component| matches!(component, std::path::Component::ParentDir))\n    {\n        bail!(\"FSKit service control path is malformed\");\n    }\n    let parent = control_path","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fskit/src/service.rs#L154-L190","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Restore the genuine kernel-written lease.json (small, <64 KiB) at resource_path","Re-issue the lease so a fresh manifest is written","Investigate what wrote to the resource directory; it must remain private and kernel-managed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn manifest_size_ok(resource: &std::path::Path) -> std::io::Result<bool> {\n    Ok(std::fs::metadata(resource.join(\"lease.json\"))?.len() <= 64 * 1024)\n}","typeGuard":null,"tryCatchPattern":"match std::fs::metadata(resource.join(\"lease.json\")) {\n    Ok(m) if m.len() > 64 * 1024 => return Err(anyhow!(\"lease manifest too large\")),\n    _ => {}\n}","preventionTips":["Treat the lease resource directory as read-only and kernel-managed","Never append or post-process lease.json","Alert on unexpected growth of files under the lease directory"],"tags":["fskit","lease","file-size","validation"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}