Skip to content

Comments

feat(vfox): allow plugins to request env var redaction via MiseEnvResult#8166

Merged
jdx merged 1 commit intomainfrom
feat/module-redact
Feb 15, 2026
Merged

feat(vfox): allow plugins to request env var redaction via MiseEnvResult#8166
jdx merged 1 commit intomainfrom
feat/module-redact

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Feb 15, 2026

Summary

  • Adds a redact field to MiseEnvResult that plugins can return from their MiseEnv hook
  • When a plugin sets redact = true, mise will automatically redact all env vars from that module unless the user explicitly sets redact = false in their mise.toml
  • User's explicit redact setting in mise.toml always takes priority over the plugin's preference

This enables secret-management plugins like fnox-env to have their environment variables automatically redacted without requiring manual configuration.

Closes jdx/fnox#280

Test plan

  • Verify existing module redaction behavior (redact = true in mise.toml) still works
  • Verify a plugin returning redact = true causes env vars to be redacted by default
  • Verify user can override plugin's redact = true with redact = false in mise.toml
  • Verify plugins not setting redact default to false (backward compatible)

🤖 Generated with Claude Code


Note

Medium Risk
Changes default redaction behavior for module-provided env vars, which can alter what users see in output and may mask values unexpectedly if plugins start setting redact = true.

Overview
Adds a new redact boolean to vfox MiseEnvResult/MiseEnvResponse and Lua type definitions, and extends Lua deserialization to accept it in the hook’s extended return format.

Updates env module resolution so module redaction is decided as mise.toml’s explicit redact option when set, otherwise the plugin’s redact preference; affected env keys are added to the global redaction list accordingly.

Written by Cursor Bugbot for commit d0f4f86. This will update automatically on new commits. Configure here.

Adds a `redact` field to `MiseEnvResult` that plugins can set to `true` to
indicate their env vars contain sensitive values and should be redacted by
default. The user's explicit `redact` setting in mise.toml takes priority.

This enables secret-management plugins like fnox-env to have their env vars
automatically redacted without requiring manual configuration.

Closes jdx/fnox#280

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 15, 2026 14:53
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the 'vfox' plugin system by enabling plugins to declare whether their environment variables should be redacted by default. This feature allows for more secure handling of sensitive information, such as API keys or tokens, by automatically obscuring them in output unless explicitly configured otherwise by the user. It streamlines the integration of secret management tools and improves the overall security posture of 'mise' environments.

Highlights

  • Plugin-driven Redaction: Introduced a 'redact' field in 'MiseEnvResult' allowing 'vfox' plugins to request environment variable redaction.
  • Automatic Redaction: When a plugin sets 'redact = true', 'mise' will automatically redact those environment variables by default.
  • User Override: Users can explicitly override a plugin's redaction preference by setting 'redact = false' in their 'mise.toml' configuration.
  • Enhanced Secret Management: Simplifies secret management for plugins like 'fnox-env' by removing the need for manual configuration.
Changelog
  • crates/vfox/src/hooks/mise_env.rs
    • Added 'redact: bool' field to 'MiseEnvResult' struct.
    • Updated 'FromLua' implementation to parse the new 'redact' field from Lua tables, defaulting to 'false'.
    • Modified the extended format check to include the 'redact' key.
  • crates/vfox/types/mise-plugin.lua
    • Added documentation for the 'redact' field to the 'MiseEnvResult' type definition.
  • src/config/env_directive/mod.rs
    • Adjusted the call to 'Self::module' to pass the 'redact' parameter as an 'Option'.
  • src/config/env_directive/module.rs
    • Changed the 'redact' parameter in 'EnvResults::module' to 'Option'.
    • Implemented logic to determine 'should_redact', prioritizing the user's explicit 'redact' setting over the plugin's 'redact' preference.
  • src/plugins/vfox_plugin.rs
    • Added 'redact: bool' field to 'MiseEnvResponse' struct.
    • Populated the 'redact' field in 'MiseEnvResponse' from the 'MiseEnvResult'.
Activity
  • Test plan provided to verify existing and new redaction behaviors, including user overrides and backward compatibility.
  • The pull request was generated with Claude Code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a redact field to MiseEnvResult, allowing vfox plugins to request redaction of their environment variables by default. The implementation is clean and logical, correctly prioritizing user configuration in mise.toml over the plugin's preference. The changes are consistently applied across the Rust code and the Lua type definitions. The logic for parsing the new field from Lua and the updated environment resolution in module.rs are both well-executed. Overall, this is a solid feature addition that improves secret management capabilities for plugins.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the vfox env hook contract to let plugins request automatic environment-variable redaction, and wires that preference into mise’s env-module directive resolution with user-configured redaction intended to take precedence.

Changes:

  • Add redact to vfox MiseEnvResult / mise MiseEnvResponse so plugins can request default redaction.
  • Update env module resolution to prefer a user-provided redact setting over the plugin’s redact preference.
  • Update Lua type definitions to document the new redact field.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/plugins/vfox_plugin.rs Propagates redact from vfox hook result into mise’s internal env response.
src/config/env_directive/module.rs Applies redaction based on user override vs plugin preference when ingesting module env vars.
src/config/env_directive/mod.rs Passes redact: Option<bool> through to module resolution (instead of forcing a default).
crates/vfox/types/mise-plugin.lua Documents redact? in the MiseEnvResult Lua type.
crates/vfox/src/hooks/mise_env.rs Adds redact to MiseEnvResult and parses it from Lua extended results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to +55
// User's explicit redact setting takes priority, otherwise use plugin's preference
let should_redact = redact.unwrap_or(response.redact);
for (k, v) in response.env {
if redact {
if should_redact {
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The override logic here depends on redact being populated from the user’s mise.toml, but module directives currently only extract tools into EnvDirectiveOptions (the redact key remains inside the plugin options table). As a result, redact will always be None for EnvDirective::Module, so users won’t be able to force redaction on/off or override a plugin’s redact=true preference as described. Consider parsing/removing a top-level redact boolean from the module’s TOML table (similar to tools) into EnvDirectiveOptions.redact, so redact = true/false works and correctly takes priority over the plugin’s preference.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +29
#[derive(Debug, Default)]
pub struct MiseEnvResult {
/// Environment variables to set
pub env: Vec<EnvKey>,
/// Whether this module's output can be cached
/// Defaults to false for backward compatibility
pub cacheable: bool,
/// Files to watch for cache invalidation
pub watch_files: Vec<PathBuf>,
/// Whether the plugin wants its env vars to be redacted
/// When true, mise will redact these values unless the user explicitly opts out
pub redact: bool,
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a new public field to MiseEnvResult is a breaking change for downstream crates that construct the struct with a literal or pattern-match it exhaustively. If vfox is intended to be a stable public API, consider marking MiseEnvResult as #[non_exhaustive] and/or providing constructors/accessors to avoid future breaking additions, and ensure the crate versioning/release notes reflect the breaking change.

Copilot uses AI. Check for mistakes.
Comment on lines 62 to 101
@@ -87,11 +91,20 @@
))
})?
.unwrap_or_default();
let redact: bool = table
.get::<Option<bool>>("redact")
.map_err(|e| {
LuaError::RuntimeError(format!(
"Invalid 'redact' field in MiseEnv result: expected boolean. Error: {e}"
))
})?
.unwrap_or(false);
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are unit tests for other hook result parsers in crates/vfox/src/hooks/ but none for MiseEnvResult::from_lua. Since this change adds new parsing logic and error messaging for the redact field (and alters extended-format detection), please add tests covering: default redact=false when omitted, redact=true when provided, and invalid types producing the expected runtime error.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 x -- echo 23.9 ± 0.5 23.2 29.0 1.00
mise x -- echo 24.0 ± 0.4 23.4 26.7 1.01 ± 0.03

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 env 23.6 ± 0.8 22.8 30.3 1.00
mise env 24.0 ± 0.9 23.0 30.3 1.02 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 hook-env 24.4 ± 0.5 23.4 26.6 1.01 ± 0.03
mise hook-env 24.3 ± 0.4 23.6 29.1 1.00

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 ls 22.3 ± 0.3 21.7 23.9 1.00
mise ls 22.5 ± 0.3 21.7 24.2 1.01 ± 0.02

xtasks/test/perf

Command mise-2026.2.13 mise Variance
install (cached) 129ms 128ms +0%
ls (cached) 80ms 79ms +1%
bin-paths (cached) 84ms 82ms +2%
task-ls (cached) 808ms 827ms -2%

@jdx jdx merged commit b4176c6 into main Feb 15, 2026
44 checks passed
@jdx jdx deleted the feat/module-redact branch February 15, 2026 17:35
mise-en-dev added a commit that referenced this pull request Feb 16, 2026
### 🚀 Features

- **(vfox)** allow plugins to request env var redaction via
MiseEnvResult by @jdx in [#8166](#8166)
- add a default_host setting for rust by @aacebedo in
[#8154](#8154)
- add github_content package support for aqua backend by @risu729 in
[#8147](#8147)
- support devEngines.runtime in deno by @risu729 in
[#8144](#8144)

### 🐛 Bug Fixes

- **(asset_matcher)** penalize vsix files by @risu729 in
[#8151](#8151)
- **(edit)** strip formatting whitespace from TOML values in `mise edit`
by @jdx in [#8162](#8162)
- **(install)** improve --locked support for python and ubi backends by
@jdx in [#8163](#8163)
- **(npm)** suppress npm update notifier while npm install by @risu729
in [#8152](#8152)
- **(schema)** add task_templates, extends, and timeout by @risu729 in
[#8145](#8145)

### 🚜 Refactor

- **(registry)** remove [key=value] options syntax from backends by
@risu729 in [#8146](#8146)

### 📚 Documentation

- **(settings)** remove wrong tip for github_attestations by @risu729 in
[#8158](#8158)

### Chore

- **(release-plz)** delete embedded plugins directory before update by
@risu729 in [#8149](#8149)
- adds necessary env var to the mcp help message in cli by @joaommartins
in [#8133](#8133)

### New Contributors

- @joaommartins made their first contribution in
[#8133](#8133)

## 📦 Aqua Registry Updates

#### New Packages (5)

- [`containers/podlet`](https://github.com/containers/podlet)
-
[`hickford/git-credential-azure`](https://github.com/hickford/git-credential-azure)
-
[`hickford/git-credential-oauth`](https://github.com/hickford/git-credential-oauth)
- [`kovetskiy/mark`](https://github.com/kovetskiy/mark)
- [`openbao/openbao/bao`](https://github.com/openbao/openbao/bao)
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
### 🚀 Features

- **(vfox)** allow plugins to request env var redaction via
MiseEnvResult by @jdx in [jdx#8166](jdx#8166)
- add a default_host setting for rust by @aacebedo in
[jdx#8154](jdx#8154)
- add github_content package support for aqua backend by @risu729 in
[jdx#8147](jdx#8147)
- support devEngines.runtime in deno by @risu729 in
[jdx#8144](jdx#8144)

### 🐛 Bug Fixes

- **(asset_matcher)** penalize vsix files by @risu729 in
[jdx#8151](jdx#8151)
- **(edit)** strip formatting whitespace from TOML values in `mise edit`
by @jdx in [jdx#8162](jdx#8162)
- **(install)** improve --locked support for python and ubi backends by
@jdx in [jdx#8163](jdx#8163)
- **(npm)** suppress npm update notifier while npm install by @risu729
in [jdx#8152](jdx#8152)
- **(schema)** add task_templates, extends, and timeout by @risu729 in
[jdx#8145](jdx#8145)

### 🚜 Refactor

- **(registry)** remove [key=value] options syntax from backends by
@risu729 in [jdx#8146](jdx#8146)

### 📚 Documentation

- **(settings)** remove wrong tip for github_attestations by @risu729 in
[jdx#8158](jdx#8158)

### Chore

- **(release-plz)** delete embedded plugins directory before update by
@risu729 in [jdx#8149](jdx#8149)
- adds necessary env var to the mcp help message in cli by @joaommartins
in [jdx#8133](jdx#8133)

### New Contributors

- @joaommartins made their first contribution in
[jdx#8133](jdx#8133)

## 📦 Aqua Registry Updates

#### New Packages (5)

- [`containers/podlet`](https://github.com/containers/podlet)
-
[`hickford/git-credential-azure`](https://github.com/hickford/git-credential-azure)
-
[`hickford/git-credential-oauth`](https://github.com/hickford/git-credential-oauth)
- [`kovetskiy/mark`](https://github.com/kovetskiy/mark)
- [`openbao/openbao/bao`](https://github.com/openbao/openbao/bao)
jdx added a commit to jdx/mise-env-fnox that referenced this pull request Feb 21, 2026
## Summary
- Sets `redact = true` in the `MiseEnv` hook response so fnox secrets
are automatically redacted in mise output
- fnox secrets are sensitive by definition, so this should be the
default behavior
- Users can still override with `redact = false` in their `mise.toml`
module config

Depends on jdx/mise#8166 for the `redact` field to be recognized by
mise.

Closes jdx/fnox#280

## Test plan
- [ ] Verify fnox env vars are redacted in `mise env` output after
updating both mise and this plugin
- [ ] Verify user can override with `[env._.modules.fnox-env] redact =
false`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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