Skip to content

feat(kits): add a built-in mise kit - #23

Merged
paveq merged 2 commits into
mainfrom
feat/mise-kit
Nov 4, 2026
Merged

paveq merged 2 commits into
mainfrom
feat/mise-kit

Conversation

@paveq

@paveq paveq commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Adds a built-in mise kit so an airlock run agent can use tool versions you've already installed with mise. It also fixes a bug in custom kits: the {kit_state} directory was never writable.

mise kit

mise dir Agent access
MISE_DATA_DIR (installs, shims, plugins) read-only in both modes; these are executables your shell runs
MISE_CONFIG_DIR read-only in both modes; mise can't resolve global tool versions without it
MISE_STATE_DIR read-only in both modes; it holds mise trust decisions, and a writable one would let the agent trust a hostile mise.toml
MISE_CACHE_DIR isolated: a per-project {kit_state}/cache, shared: the real cache

Each path honors MISE_*_DIR, then XDG_*_HOME, then mise's defaults (on macOS the cache is ~/Library/Caches/mise). The agent can't mise install or mise trust, so a project's mise.toml works for the agent only after you've trusted it yourself. SECURITY.md covers the risk of shared mode: the agent could poison cached exec() template output.

Fix: custom kits' {kit_state} is now writable

{kit_state} was expanded in env, but the directory was neither created nor added to the agent's write grants. As a result, the README's BAZEL_OUTPUT_USER_ROOT = "{kit_state}/out" example pointed the agent at a directory it couldn't write. The directory now goes into write, so it passes the same anchor checks as every other write path.

Testing

  • cargo test < /dev/null (full suite, run outside the sandbox), cargo clippy --all-targets and cargo fmt --check all pass.
  • New unit tests for the mise kit: both modes, both platforms, MISE_*/XDG_* overrides, and a check that installs and state are never writable.
  • End to end on macOS with airlock run --kit mise:
    • crane resolves through the shims, and [env] applies.
    • The isolated cache is writable.
    • Writes to installs, shims and state are denied, and so is mise trust.
    • Shared mode writes the real cache.
    • A custom kit's {kit_state}/out is writable.
  • Not run on Linux/Landlock locally; CI covers the unit tests there.

🤖 Generated with Claude Code

paveq added 2 commits November 4, 2026 15:33
A user-defined kit can use `{kit_state}` only in `env`; `read`/`write`
don't expand it. `expand_all` recorded the directory in `state_dirs`,
but only the launcher's anchor check reads that field. Nothing created
the directory or added it to the agent's write grants. So the documented
`BAZEL_OUTPUT_USER_ROOT = "{kit_state}/out"` example pointed the agent
at a directory it could neither create nor write.

The directory now goes into `write` too, like an isolated built-in's
subdirectories. That puts it through the same anchor and filtered-PATH
checks, and the launcher creates it with mode 0700.
Lets an `airlock run` agent use tool versions the user already
installed with mise: the shims on PATH, the project's `[tools]` and
`[env]`, and the global config. Without the kit, mise inside the sandbox
can't read its installs or config at all.

The kit reads mise's data, config and state dirs in both modes. It
honors `MISE_*_DIR` and then `XDG_*_HOME`, as mise does. The two modes
differ only in `MISE_CACHE_DIR`. Installs and shims are never writable
because the user's shell runs them. The state dir isn't writable either:
it holds `mise trust` decisions, and an agent that could write it could
trust a hostile `mise.toml` that the user's shell then applies on `cd`.
mise works with a read-only state dir. The only side effect is a
"tracking config" warning for a project the user has never run mise in.

Checked end to end with `airlock run --kit mise` on macOS:
- Shims resolve, and `[env]` applies.
- The isolated cache is writable.
- Writes to installs, shims and state are denied, and so is `mise trust`.
- Shared mode writes the real cache.
@paveq
paveq merged commit 625fedb into main Nov 4, 2026
5 checks passed
@paveq
paveq deleted the feat/mise-kit branch November 4, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant