Hmbown/CodeWhale · error
plugin path escapes plugins directory
Error message
plugin path {} escapes plugins directory {} What it means
`ensure_target_within_plugins_dir` canonicalizes the plugins root and the target, then requires the target's parent to be exactly the plugins root. If a symlink or `..` component makes the resolved target land outside the plugins directory, it bails — a defense against symlink escapes during uninstall/finalize.
Solutions
- Remove symlinks so the plugin is a real directory directly inside the user plugins dir
- Install the plugin with `/plugin install` rather than linking manually
- If you intentionally keep plugins elsewhere, point the plugins dir setting at the real location and use real directories
Example fix
// before: escape via symlink ln -s ~/elsewhere/myplugin ~/.codewhale/plugins/myplugin // after: real directory in place cp -r ~/elsewhere/myplugin ~/.codewhale/plugins/myplugin
Defensive patterns
Strategy: validation
Validate before calling
let root = fs::canonicalize(user_plugins_dir)?;
let target = fs::canonicalize(root.join(name))?;
if target.parent() != Some(root.as_path()) {
eprintln!("{} would escape the plugins dir", name);
return;
} Try / catch
match uninstall(name, dir) {
Err(e) if e.to_string().contains("escapes plugins directory") => {
eprintln!("plugin target is a symlink or traversal; remove it manually");
}
other => other?,
} Prevention
- Do not symlink plugins into the plugins dir; copy them
- Keep plugin names as plain [A-Za-z0-9._-] identifiers
- Point the plugins-dir setting at the real directory, not a symlink
When it happens
Trigger: `uninstall`, `update`, or `finalize_install` resolving to a target whose canonical parent is not the plugins dir — e.g. the plugin name is a symlink pointing elsewhere, or the plugins dir itself is symlinked such that canonicalize rewrites the root.
Common situations: A user symlinked a plugin folder to another disk/location; the plugins directory is itself a symlink (canonicalized root no longer matches the target's parent); a malicious install tried to plant a link escaping the root.
Understand the failure class
Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.
Related errors
- plugin archive bundle path must contain only safe relative…
- audited skill path does not match owned package
- built-in plugin path may not be a symbolic link or reparse…
- bundle path escapes the config directory via a symlink…
- bundle path is absolute; only paths inside the config…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/575bf929403eae53.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/plugins/install/place.rs:144
Ok(user_plugins_dir.join(name))
}
/// The resolved bundle must be a direct child of the resolved plugins root,
/// matching discovery's fail-closed containment rule.
pub(super) fn ensure_target_within_plugins_dir(
target: &Path,
user_plugins_dir: &Path,
) -> Result<()> {
let root = fs::canonicalize(user_plugins_dir).with_context(|| {
format!(
"failed to resolve plugins directory {}",
user_plugins_dir.display()
)
})?;
let target = fs::canonicalize(target)
.with_context(|| format!("failed to resolve {}", target.display()))?;
if target.parent() != Some(root.as_path()) {
bail!(
"plugin path {} escapes plugins directory {}",
target.display(),
root.display()
);
}
Ok(())
}
View on GitHub (pinned to 73e0f67d83)