zeroclaw-labs/zeroclaw · error · anyhow::Error
refusing to write outside the FTL data directory
Error message
refusing to write outside the FTL data directory
What it means
Path-confinement check for locale catalog installation: after canonicalization the destination escapes the FTL data directory, so the write is refused. Security guard against symlink/path traversal, not a permissions problem.
Solutions
- Write FTL files only inside the designated FTL data directory.
- Change the output path to a location within the FTL data directory and retry.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/main.rs:3355 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/50445b95fb26d170.
Report an issue: GitHub.
Appendix: source
Thrown at src/main.rs:3355
bail!("unknown catalog '{name}'; valid: {valid}");
}
}
}
out
}
};
let dest = zeroclaw_config::schema::ftl_locale_dir(&locale)?;
std::fs::create_dir_all(&dest).with_context(|| format!("creating {}", dest.display()))?;
// Confinement check: the resolved dest must live under the data-dir FTL root.
let ftl_root = dest
.parent()
.map(Path::to_path_buf)
.unwrap_or_else(|| dest.clone());
let canon_dest = std::fs::canonicalize(&dest).unwrap_or_else(|_| dest.clone());
let canon_root = std::fs::canonicalize(&ftl_root).unwrap_or(ftl_root);
if !canon_dest.starts_with(&canon_root) {
bail!("refusing to write outside the FTL data directory");
}
// Prefer the tag matching this binary; fall back to master.
let version = env!("CARGO_PKG_VERSION");
let refs = [format!("v{version}"), "master".to_string()];
let client = reqwest::Client::new();
let mut fetched = 0u32;
for (name, path_tmpl, out_name) in selected {
let repo_path = path_tmpl.replace("{locale}", &locale);
let mut body: Option<String> = None;
for git_ref in &refs {
let url = format!(
"https://raw.githubusercontent.com/zeroclaw-labs/zeroclaw/{git_ref}/{repo_path}"
);
let resp = client.get(&url).send().await?;
if resp.status().is_success() {
body = Some(resp.text().await?);View on GitHub (pinned to 88bb9c8533)