jdx/mise · error · eyre::Report

per-host network filtering (--allow-net=<host>) is not suppo

Error message

per-host network filtering (--allow-net=<host>) is not supported on Linux. Use --deny-net to block all network, or remove --allow-net.

What it means

CmdLineRunner::apply_sandbox() configures the platform sandbox for a command; on Linux it only implements all-or-nothing network blocking, so a sandbox spec with per-host allow_net entries fails fast before spawn (src/cmd.rs:1545-1551) with an explicit message pointing at --deny-net. This is a deliberate guard: per-host filtering is only implemented for the macOS sandbox profile.

Source

Thrown at src/cmd.rs:1544

                Err(err) => return Err(err),
            }
        }
    }

    /// Prepare sandbox restrictions on the command. Must be called before execute()
    /// when sandbox is configured. This is async because macOS DNS resolution is async.
    pub async fn apply_sandbox(&mut self) -> eyre::Result<()> {
        let Some(sandbox) = self.sandbox.take() else {
            return Ok(());
        };
        if !sandbox.is_active() {
            return Ok(());
        }

        // Fail early on Linux if per-host network filtering is requested
        #[cfg(target_os = "linux")]
        if !sandbox.allow_net.is_empty() {
            eyre::bail!(
                "per-host network filtering (--allow-net=<host>) is not supported on Linux. \
                 Use --deny-net to block all network, or remove --allow-net."
            );
        }

        #[cfg(target_os = "linux")]
        {
            // On Linux, clear inherited env before pre_exec so child only sees filtered vars.
            // env_clear() also wipes envs explicitly set via .envs(), so save and restore them.
            if sandbox.effective_deny_env() {
                let saved: Vec<(std::ffi::OsString, std::ffi::OsString)> = self
                    .cmd
                    .as_std()
                    .get_envs()
                    .filter_map(|(k, v)| v.map(|v| (k.to_os_string(), v.to_os_string())))
                    .collect();
                self.cmd.env_clear();
                for (k, v) in saved {

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Drop the per-host allow on Linux: run with `--deny-net` (block all network) and pre-fetch dependencies before the sandboxed step
  2. Remove `--allow-net`/allow_net so the task runs unsandboxed for network purposes
  3. Move the sandboxed-network-permission step to a macOS runner if per-host semantics are required

Example fix

# before (Linux)
mise run --allow-net=registry.npmjs.org build

# after — pre-fetch, then block all network
npm ci
mise run --deny-net build
Defensive patterns

Strategy: validation

Validate before calling

# gate per-host network allows by platform before invoking mise
if [ "$(uname -s)" = "Linux" ]; then
  mise run --deny-net build     # no per-host support on Linux
else
  mise run --allow-net=registry.example.com build
fi

Type guard

fn supports_per_host_allow_net() -> bool { #![cfg(target_os = "macos")] true } // compile-time platform guard: per-host allow_net is macOS-only in mise's sandbox

Try / catch

If you drive mise programmatically, inspect the stderr for 'per-host network filtering' and fail with a platform-specific hint instead of retrying with the same flags on Linux.

Prevention

When it happens

Trigger: Running a mise task with per-host network allows on Linux: `mise run --allow-net=registry.npmjs.org my-task`, or a task/config declaring sandbox allow_net hosts, on any Linux kernel.

Common situations: A sandboxed task config authored/tested on macOS then executed in a Linux CI container; users trying to permit just a package registry while sandboxing builds.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/f831c37ebd2b4f6f. Report an issue: GitHub.