{"record":{"id":"03e800c898c96455","repo":"jdx/mise","slug":"remote-host-bootstrap-command-contains-nul","errorCode":null,"errorMessage":"remote host '{}' bootstrap command contains NUL","messagePattern":"remote host '(.+?)' bootstrap command contains NUL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":405,"sourceCode":"        }\n        for exclude in &self.exclude {\n            validate_value(\"archive exclude\", exclude)?;\n        }\n        for env in &self.mise_env {\n            validate_value(\"mise environment\", env)?;\n            if env.contains(',') {\n                bail!(\"remote mise environment cannot contain a comma: {env}\");\n            }\n        }\n        if let Some(remote_mise) = &self.remote_mise {\n            validate_remote_executable(remote_mise)?;\n        }\n        if self\n            .bootstrap_command\n            .as_ref()\n            .is_some_and(|command| command.contains('\\0'))\n        {\n            bail!(\"remote host '{}' bootstrap command contains NUL\", self.name);\n        }\n        Ok(())\n    }\n}\n\npub(crate) async fn run(\n    host: &RemoteHost,\n    options: &RemoteRunOptions,\n    artifacts: &mut RemoteArtifactResolver,\n    repository: Option<&super::remote_repository::Source>,\n) -> Result<()> {\n    run_inner(host, options, artifacts, repository).await\n}\n\n/// Observe cancellation inside resource ownership, so cleanup can still be awaited.\npub(crate) async fn interruptible<T>(\n    operation: impl std::future::Future<Output = Result<T>>,\n) -> Result<T> {","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote.rs#L387-L423","documentation":"A bootstrap_command is transmitted to the remote host as a NUL-terminated/executable command string; embedding a NUL byte would silently truncate or corrupt it, so validate_with_source rejects any bootstrap command containing '\\0'.","triggerScenarios":"A remote host entry sets bootstrap_command to a string containing a NUL byte (typically from binary data, bad string handling, or reading the script from a corrupted source); validate() or apply_overrides() bail.","commonSituations":"Programmatically building the command from byte buffers or file contents that include '\\0'; template substitution injecting null bytes; copy-paste of binary content into config.","solutions":["Inspect the configured command for stray NUL bytes and remove them.","If the command comes from a file, re-export it as clean UTF-8 text without null bytes.","Fix the generating code to strip/forbid '\\0' when assembling the command string.","Reference the script by path (e.g. upload then run) instead of embedding raw bytes."],"exampleFix":"// before\nbootstrap_command = some_bytes_as_string_with_nul\n// after\nbootstrap_command = \"bash /opt/bootstrap.sh\"","handlingStrategy":"validation","validationCode":"function assertNoNul(host) {\n  if (host.bootstrap_command && host.bootstrap_command.includes('\\0')) {\n    throw new Error(`remote host '${host.name}' bootstrap command contains NUL`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep bootstrap commands as plain text scripts, not byte buffers.","Strip control characters when building commands programmatically: cmd.replace(/\\0/g, '').","Reference external scripts by uploaded file path instead of embedding raw content."],"tags":["remote","configuration","validation","shell"],"backgroundTag":"invalid-argument-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}