diff --git a/vmm/src/api/http_endpoint.rs b/vmm/src/api/http_endpoint.rs index 00f1584ba..727939dde 100644 --- a/vmm/src/api/http_endpoint.rs +++ b/vmm/src/api/http_endpoint.rs @@ -36,13 +36,22 @@ impl EndpointHandler for VmCreate { match &req.body { Some(body) => { // Deserialize into a VmConfig - let vm_config: VmConfig = match serde_json::from_slice(body.raw()) + let mut vm_config: VmConfig = match serde_json::from_slice(body.raw()) .map_err(HttpError::SerdeJsonDeserialize) { Ok(config) => config, Err(e) => return error_response(e, StatusCode::BadRequest), }; + if let Some(ref mut nets) = vm_config.net { + if nets.iter().any(|net| net.fds.is_some()) { + warn!("Ignoring FDs sent via the HTTP request body"); + } + for net in nets { + net.fds = None; + } + } + // Call vm_create() match vm_create(api_notifier, api_sender, Arc::new(Mutex::new(vm_config))) .map_err(HttpError::ApiError)