fix(task): require trust for config-less task includes#10355
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds conditional trust validation when loading task include paths in config-less scenarios and a Bash end-to-end test that verifies untrusted includes are blocked in single-repo and monorepo workflows. ChangesTask Include Trust Validation
Sequence DiagramsequenceDiagram
participant CLI as mise (CLI)
participant Loader as load_tasks_in_dir
participant Includes as load_tasks_includes
participant Trust as trust_check
participant FS as FileSystem
CLI->>Loader: run "mise tasks" / resolve include paths
Loader->>Includes: resolve default & configured include paths (require_trust?)
Includes->>Trust: trust_check_task_include(path, require_trust)
Trust-->>Includes: allowed / denied
alt allowed
Includes->>FS: read task include and render templates
else denied
Includes->>CLI: surface "not trusted" error
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/config/mod.rs (1)
2593-2624:⚠️ Potential issue | 🟠 Major | ⚡ Quick winClose the config-less include trust bypass in monorepo subdir loading.
This only protects the
load_tasks_in_dir()path. The config-less monorepo fallback at Lines 2025-2041 still callstask_includes_for_dir()andload_tasks_includes()without atrust_check, somise-tasks/*.tomlin a discovered subdirectory can still render templates before trust when tasks are loaded via--allor path hints.A small helper that applies the same
require_task_include_trust && !is_global_task_include_path(...)check before every default-include load would keep the two call paths aligned.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/config/mod.rs` around lines 2593 - 2624, The monorepo subdir fallback path that calls task_includes_for_dir() and load_tasks_includes() needs the same include-trust enforcement as the load_tasks_in_dir() path; add the same check using require_task_include_trust && !is_global_task_include_path(path) before loading any default/config-less includes and call trust_check(path) when it fails, or centralize that logic into a small helper (e.g., validate_task_include_trust) and use it from both load_tasks_in_dir() and the monorepo fallback where task_includes_for_dir() / load_tasks_includes() are invoked so both code paths enforce trust consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@e2e/tasks/test_task_include_trust`:
- Around line 19-31: The test currently discards the mise tasks exit status with
"|| true" and only checks the output for the word "trust"; change the test to
capture the exit code immediately after running mise (store $? into a variable
like "rc") and assert that rc != 0 before checking the output for trust-related
text; locate the command that sets "output=$(MISE_YES=0 MISE_PARANOID=1 mise
tasks 2>&1 || true)" and update the logic around the "output" and "marker"
checks so the script fails if the command succeeded (rc == 0) and only then
proceeds to grep "$output" for the trust message.
---
Outside diff comments:
In `@src/config/mod.rs`:
- Around line 2593-2624: The monorepo subdir fallback path that calls
task_includes_for_dir() and load_tasks_includes() needs the same include-trust
enforcement as the load_tasks_in_dir() path; add the same check using
require_task_include_trust && !is_global_task_include_path(path) before loading
any default/config-less includes and call trust_check(path) when it fails, or
centralize that logic into a small helper (e.g., validate_task_include_trust)
and use it from both load_tasks_in_dir() and the monorepo fallback where
task_includes_for_dir() / load_tasks_includes() are invoked so both code paths
enforce trust consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bae6cad2-dffd-487f-a564-36a12e4a1140
📒 Files selected for processing (2)
e2e/tasks/test_task_include_trustsrc/config/mod.rs
Greptile SummaryThis PR closes a security gap where default task-include directories (e.g.
Confidence Score: 5/5The trust gate is correctly placed: it fires only for config-less directories, exempts global task paths, and is bypassed for includes that come from an already-trusted config file. The The core security logic is correct — No files require special attention; the error-message presentation in Important Files Changed
Reviews (4): Last reviewed commit: "fix(task): require trust for config-less..." | Re-trigger Greptile |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.4 x -- echo |
21.7 ± 1.3 | 19.5 | 26.7 | 1.01 ± 0.10 |
mise x -- echo |
21.5 ± 1.8 | 18.8 | 43.7 | 1.00 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.4 env |
19.8 ± 1.0 | 17.8 | 25.4 | 1.00 |
mise env |
20.2 ± 1.1 | 18.2 | 25.2 | 1.02 ± 0.08 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.4 hook-env |
20.4 ± 1.3 | 18.1 | 26.5 | 1.00 |
mise hook-env |
22.6 ± 2.7 | 18.5 | 39.6 | 1.11 ± 0.15 |
hook-env measured 11% slower, but the relative uncertainty overlaps the 10% threshold. |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.4 ls |
16.7 ± 0.9 | 15.3 | 20.9 | 1.00 |
mise ls |
17.5 ± 1.1 | 15.4 | 22.4 | 1.05 ± 0.08 |
xtasks/test/perf
| Command | mise-2026.6.4 | mise | Variance |
|---|---|---|---|
| install (cached) | 139ms | 140ms | +0% |
| ls (cached) | 60ms | 60ms | +0% |
| bin-paths (cached) | 68ms | 68ms | +0% |
| task-ls (cached) | 128ms | 132ms | -3% |
d409738 to
4a1b175
Compare
4a1b175 to
306fe66
Compare
Summary
Tests
cargo fmt --checkmise run test:e2e e2e/tasks/test_task_include_trustmise run test:e2e e2e/tasks/test_task_untrusted_config_errorThis PR was generated by an AI coding assistant.
Note
High Risk
Security fix around trust boundaries and task template execution; behavior changes for untrusted clones that only have mise-tasks directories.
Overview
Closes a security gap where default task include directories (e.g.
mise-tasks/,.mise-tasks/) could be loaded and Tera templates rendered (includingexec()) in repos with no local mise config, before the user trusts the project.Task loading now runs
trust_checkon each include file/dir when discovery is config-less (require_task_include_trust), while includes declared from a trustedmise.tomlstill skip that extra gate (require_trust: false). Global task include paths under the user/system config dirs remain exempt.config_rootis updated so paths undermise-tasks/.mise-tasks(and related task file layouts) resolve to the project root for trust checks. An e2e test asserts untrusted includes fail with a trust error and never runexec()from task descriptions, including monorepo subdirs with--all.Reviewed by Cursor Bugbot for commit 306fe66. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests