{"record":{"id":"82f81a2586a49541","repo":"astrid-runtime/astrid","slug":"fskit-service-control-path-is-malformed","errorCode":null,"errorMessage":"FSKit service control path is malformed","messagePattern":"FSKit service control path is malformed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-fskit/src/service.rs","lineNumber":188,"sourceCode":"        .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\n        .parent()\n        .context(\"FSKit service control path has no parent\")?;\n    platform_fs::validate_private_directory(parent)\n        .context(\"validate private FSKit control parent\")?;\n    platform_fs::verify_no_redirects(control_path)\n        .context(\"reject redirected FSKit control path\")?;\n    if control_path != resource_path.join(\"process-control.sock\") {\n        bail!(\"FSKit service control path is not the kernel endpoint\");\n    }\n    if local_transport::endpoint_is_present(control_path)\n        .context(\"inspect FSKit service control endpoint\")?\n    {\n        bail!(\"FSKit service control endpoint is already present\");\n    }\n    Ok(())\n}","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fskit/src/service.rs#L170-L206","documentation":"validate_control_path requires the service control path to be absolute and free of ParentDir (..) components. Paths with '..' can escape the intended private directory, so they are rejected as malformed before any filesystem access.","triggerScenarios":"validate_launch passes a control_path that is relative or contains '..' segments (e.g. \"/var/fskit/../tmp/ctl.sock\" or \"ctl.sock\").","commonSituations":"String-concatenated paths from templates or CLI args; user-supplied paths not normalized; configs that use ../ to work around directory layout.","solutions":["Provide an absolute, '..'-free control path equal to resource_path/process-control.sock","Normalize the path with components()/clean before validating (must still be absolute afterwards)","Reject or fix upstream input that injects '..' segments"],"exampleFix":"// before\ncontrol_path: \"/var/fskit/leases/a/../ctl.sock\".into()\n// after\ncontrol_path: \"/var/fskit/leases/a/process-control.sock\".into()","handlingStrategy":"validation","validationCode":"fn control_path_ok(p: &std::path::Path) -> bool {\n    p.is_absolute()\n        && !p.components().any(|c| matches!(c, std::path::Component::ParentDir))\n}","typeGuard":"fn has_parent_dir(p: &std::path::Path) -> bool {\n    p.components().any(|c| matches!(c, std::path::Component::ParentDir))\n}","tryCatchPattern":null,"preventionTips":["Reject '..' in user-supplied paths at config load","Build paths from trusted components rather than string concatenation","Normalize with path cleaning, then require absoluteness"],"tags":["fskit","path-validation","path-traversal","control-path"],"backgroundTag":"path-traversal-blocked","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}