jdx/mise · error
brew-cask: refusing installer executable outside trusted…
Error message
brew-cask: refusing installer executable outside trusted installer roots: {} What it means
run_installer_artifact executes a cask installer stanza. The executable is stage.join(installer.executable) and must still resolve inside the staging directory (staged_relative_path returns Some). This first bail rejects executables that escape the stage — absolute paths or paths containing '..' — because installers must run from files mise downloaded and verified, not from arbitrary filesystem locations.
Solutions
- Point installer executable at a binary shipped inside the cask archive, relative to the stage root (e.g. "Installer.app/Contents/MacOS/Installer")
- For system-path installers, move the logic into the cask's preflight/postflight steps instead of an installer artifact
- Check the stanza for a leading '/' or '..' — that exact shape trips this check
Example fix
# before (cask stanza) installer executable: "/usr/bin/osascript", args: ["-e", "..."] # after installer executable: "install.sh", args: ["--mode", "unattended"]
Defensive patterns
Strategy: validation
Validate before calling
// Verify the installer executable stays inside the stage before installing.
fn installer_inside_stage(stage: &Path, executable: &str) -> bool {
let joined = stage.join(executable);
std::fs::canonicalize(&joined)
.map(|c| c.starts_with(std::fs::canonicalize(stage).unwrap_or_else(|_| stage.to_path_buf())))
.unwrap_or(false)
} Type guard
fn is_staged_relative(executable: &str) -> bool {
!executable.starts_with('/') && !executable.split('/').any(|seg| seg == "..")
} Prevention
- Always give installer executables as archive-relative paths
- Never reference /usr/bin, /sbin, or other absolute binaries in installer stanzas
- Put system-installer logic in preflight/postflight steps instead
When it happens
Trigger: installer executable: "/usr/bin/osascript", "/sbin/installer", or "../../System/anything" — any string that, joined onto the stage root, canonicalizes outside it.
Common situations: Casks authored for Homebrew that legitimately reference system installers (unsupported here); relative executable strings with ../ from bad templating; stanza copy-paste errors.
Related errors
- brew-cask: app target
- brew-cask: binary target
- brew-cask: : cask metadata has no sha256
- brew-cask: completion target
- brew-cask: completion target
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/c8ff27bc54aa7f19.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/brew/cask.rs:2443
let relative = appdir.strip_prefix(Path::new("/")).map_err(|_| {
eyre!(
"brew-cask: app directory '{}' must be an absolute path",
appdir.display()
)
})?;
// `allow_current_user` is true because a per-user appdir such as
// `~/Applications` is legitimately owned by the invoking user.
open_trusted_directory(Path::new("/"), relative, true, true)
}
fn run_installer_artifact(
stage: &Path,
installer: &InstallerArtifact,
copied_files: &BTreeSet<PathBuf>,
) -> Result<()> {
let executable = stage.join(&installer.executable);
if staged_relative_path(stage, &executable).is_none() {
bail!(
"brew-cask: refusing installer executable outside trusted installer roots: {}",
executable.display()
);
}
if !executable.is_file() {
bail!(
"brew-cask: installer executable '{}' was not found",
installer.executable
);
}
let executable = file::desymlink_path(&executable);
if !executable.starts_with(file::desymlink_path(stage)) && !copied_files.contains(&executable) {
bail!(
"brew-cask: refusing installer executable outside trusted installer roots: {}",
executable.display()
);
}
file::make_executable(&executable)?;View on GitHub (pinned to 6f52dcdf99)