{"record":{"id":"26ec86f19fba16ae","repo":"astrid-runtime/astrid","slug":"provider-request-exceeds-limit","errorCode":null,"errorMessage":"provider request exceeds limit","messagePattern":"provider request exceeds limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-fskit/src/main.rs","lineNumber":87,"sourceCode":"            eprintln!(\"{PROVIDER_NAME}: {error:#}\");\n            std::process::exit(2);\n        },\n    }\n}\n\nasync fn run() -> Result<StorageProviderResponseV1> {\n    let arguments = std::env::args_os().skip(1).collect::<Vec<_>>();\n    if arguments.as_slice() != [std::ffi::OsStr::new(\"--astrid-provider-stdio-v1\")] {\n        bail!(\"this executable is an Astrid provider companion, not an interactive command\");\n    }\n    let mut bytes = Vec::new();\n    std::io::stdin()\n        .lock()\n        .take(MAX_REQUEST_BYTES + 1)\n        .read_to_end(&mut bytes)\n        .context(\"read provider request\")?;\n    if bytes.len() as u64 > MAX_REQUEST_BYTES {\n        bail!(\"provider request exceeds limit\");\n    }\n    let request: StorageProviderRequestV1 =\n        serde_json::from_slice(&bytes).context(\"decode provider request\")?;\n    if request.protocol_version != STORAGE_PROVIDER_PROTOCOL_V1 {\n        bail!(\"unsupported provider protocol {}\", request.protocol_version);\n    }\n    let request_id = request.request_id;\n    let outcome = match execute(request).await {\n        Ok(success) => StorageProviderOutcomeV1::Success(success),\n        Err(error) => StorageProviderOutcomeV1::Failure(provider_failure::provider_failure(&error)),\n    };\n    Ok(StorageProviderResponseV1 {\n        protocol_version: STORAGE_PROVIDER_PROTOCOL_V1,\n        request_id,\n        provider: StorageProviderIdentityV1 {\n            name: PROVIDER_NAME.to_owned(),\n            version: env!(\"CARGO_PKG_VERSION\").to_owned(),\n            capabilities: vec![","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fskit/src/main.rs#L69-L105","documentation":"run() reads the provider request from stdin, taking MAX_REQUEST_BYTES + 1 bytes so oversized payloads are detectable. If the byte length exceeds MAX_REQUEST_BYTES the request is rejected rather than parsed, protecting the companion from unbounded memory use.","triggerScenarios":"The kernel (or any client) writes a serialized StorageProviderRequestV1 larger than MAX_REQUEST_BYTES to the companion's stdin.","commonSituations":"A mount request embedding an unusually large payload/manifest; a buggy client streaming an endless request without framing; protocol misuse where bulk data is sent over the control channel instead of the mounted filesystem.","solutions":["Reduce the request size (e.g. move large payloads out of the request body)","Check the client's serialization for accidental inclusion of bulk data","If legitimately needed, raise MAX_REQUEST_BYTES in the companion source and rebuild both sides"],"exampleFix":"// before (client)\nrequest.extra_payload = huge_blob;\nsend(serde_json::to_vec(&request)?);\n// after\nrequest.payload_ref = write_to_staging(&huge_blob)?;\nsend(serde_json::to_vec(&request)?);","handlingStrategy":"validation","validationCode":"// rust (client side, before writing to the companion's stdin)\nlet bytes = serde_json::to_vec(&request)?;\nanyhow::ensure!(bytes.len() as u64 <= MAX_REQUEST_BYTES, \"request is {} bytes, limit is {MAX_REQUEST_BYTES}\", bytes.len());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep bulk data out of provider requests; pass references/paths instead","Check serialized size before sending","Keep kernel and companion request schemas in sync"],"tags":["payload-size","ipc","rust"],"backgroundTag":"payload-too-large","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}