{"record":{"id":"ac8dc145c6d05750","repo":"jdx/mise","slug":"operation-is-disabled-in-safe-mode-mise-safe-1","errorCode":null,"errorMessage":"{operation} is disabled in safe mode (MISE_SAFE=1)\nSee https://mise.jdx.dev/configuration/settings.html#safe","messagePattern":"(.+?) is disabled in safe mode \\(MISE_SAFE=1\\)\nSee https://mise\\.jdx\\.dev/configuration/settings\\.html#safe","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/config/settings.rs","lineNumber":1439,"sourceCode":"            return Settings::get().safe;\n        }\n        // Settings not loaded (e.g. the config parse pass after Config::reset).\n        // Use the value cached from the last full load, which captures `safe`\n        // set via global config; before any load, fall back to the env var.\n        match LAST_SAFE.load(Ordering::Relaxed) {\n            0 => false,\n            1 => true,\n            _ => crate::env::var_is_true(\"MISE_SAFE\"),\n        }\n    }\n\n    /// Errors when safe mode (`MISE_SAFE=1`) is enabled. Call this before any\n    /// operation that would execute code controlled by project configuration.\n    /// Safe mode is a security boundary: blocked operations must fail loudly,\n    /// never silently fall back to something that executes.\n    pub fn ensure_not_safe(operation: &str) -> Result<()> {\n        if Settings::safe_mode() {\n            bail!(\n                \"{operation} is disabled in safe mode (MISE_SAFE=1)\\nSee https://mise.jdx.dev/configuration/settings.html#safe\"\n            );\n        }\n        Ok(())\n    }\n}\n\nfn redacted_settings_for_debug(settings: &Settings) -> Settings {\n    let mut debug_settings = settings.clone();\n    if debug_settings.task.cache.remote_token.is_some() {\n        debug_settings.task.cache.remote_token = Some(\"[redacted]\".to_string());\n    }\n    debug_settings\n}\n\nfn remove_empty_nested_settings(table: &mut toml::Table, prefix: &str) {\n    table.retain(|key, value| {\n        let path = if prefix.is_empty() {","sourceCodeStart":1421,"sourceCodeEnd":1457,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/config/settings.rs#L1421-L1457","documentation":"`Settings::ensure_not_safe` (src/config/settings.rs:1426) enforces safe mode (`MISE_SAFE=1`): a security boundary that fails loudly before any operation which would execute code controlled by project configuration (remote/git task files, config-driven commands). Blocked operations must never silently fall back to something else that executes, hence a hard error with a docs link.","triggerScenarios":"Running a guarded operation — e.g. resolving/loading `git::` remote task files via `resolve_git_url_to_path` — while `MISE_SAFE` is `1` (or any value `env::var_is_true` accepts, since only `0` forces off).","commonSituations":"Hardened CI images or corporate shells that export MISE_SAFE globally; auditing an untrusted repo with safe mode and then running ordinary commands in the same shell; wrapper scripts that set MISE_SAFE and never unset it.","solutions":["Re-run with safe mode off for this command: `MISE_SAFE=0 mise <cmd>` (or unset MISE_SAFE)","Find and remove the stray `MISE_SAFE=1` export in shell profiles, CI env, or wrapper scripts","If safe mode is intentional, do the blocked step manually outside mise (e.g. clone the repo and reference local task files)","Read the linked settings docs section to know exactly which operations are blocked before scripting around them"],"exampleFix":"# before\n$ export MISE_SAFE=1 && mise run build   # blocked\n# after\n$ unset MISE_SAFE && mise run build\n# or scoped:\n$ MISE_SAFE=0 mise run build","handlingStrategy":"validation","validationCode":"# guard scripts that need project-config execution\nif [ \"${MISE_SAFE:-0}\" = \"1\" ]; then\n  echo \"MISE_SAFE=1 blocks this mise operation; unset it or MISE_SAFE=0\" >&2; exit 1\nfi\nmise run build","typeGuard":null,"tryCatchPattern":"In wrappers, detect the `disabled in safe mode` message and branch: either re-exec with MISE_SAFE=0 after explicit approval, or report that the step must run outside safe mode — never silently skip it.","preventionTips":["Scope MISE_SAFE to the exact untrusted commands instead of exporting it globally","Keep an audited list of which operations safe mode blocks (docs link in the error) when writing CI","For untrusted repos, clone and inspect task files manually rather than toggling safe mode off"],"tags":["mise","security","safe-mode","env-var"],"backgroundTag":"safe-mode-blocked","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}