fix(env): apply redactions for env vars with both tools=true and redact=true#8449
fix(env): apply redactions for env vars with both tools=true and redact=true#8449
Conversation
…ct=true When an env var has both `tools = true` and `redact = true`, the redaction was collected during load_post_env (the tools-only path) but never applied to the global redactor. This caused the plaintext value to appear in task output instead of [redacted]. Fixes #8432 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, 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 addresses a critical security oversight where sensitive environment variables, intended for redaction and marked with "tools = true", were inadvertently exposed in task output. The changes ensure that all specified redactions are consistently applied across different environment variable loading paths, enhancing the security and privacy of task execution. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
Greptile SummaryFixed a bug where env vars with both
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: be7c085 |
Explain that redactions require non-raw output modes, and recommend using prefix or interleave output in CI for full logs with redactions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a bug where environment variables with both tools=true and redact=true were not being redacted. The fix involves applying the collected redactions from the tools=true code path to the global redactor. The added e2e test case effectively verifies this fix. The changes look good and are well-targeted.
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.1 x -- echo |
25.2 ± 0.7 | 23.0 | 30.8 | 1.00 |
mise x -- echo |
25.3 ± 0.7 | 23.8 | 34.2 | 1.00 ± 0.04 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.1 env |
24.5 ± 0.8 | 23.0 | 28.9 | 1.00 |
mise env |
24.7 ± 0.9 | 22.8 | 35.8 | 1.01 ± 0.05 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.1 hook-env |
25.1 ± 0.5 | 23.5 | 27.0 | 1.00 |
mise hook-env |
25.3 ± 0.7 | 23.7 | 34.5 | 1.01 ± 0.04 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.1 ls |
23.0 ± 0.7 | 21.8 | 25.1 | 1.00 |
mise ls |
23.4 ± 0.9 | 22.1 | 34.8 | 1.01 ± 0.05 |
xtasks/test/perf
| Command | mise-2026.3.1 | mise | Variance |
|---|---|---|---|
| install (cached) | 152ms | 154ms | -1% |
| ls (cached) | 82ms | 83ms | -1% |
| bin-paths (cached) | 87ms | 86ms | +1% |
| task-ls (cached) | 821ms | 818ms | +0% |
### 🚀 Features - add `--local` flag to `outdated` and `upgrade` commands by @malept in [#8451](#8451) ### 🐛 Bug Fixes - **(env)** apply redactions for env vars with both tools=true and redact=true by @jdx in [#8449](#8449) - **(prepare)** render tera templates in prepare.env values by @jdx in [#8450](#8450) - correct regex syntax in tar/zstd version check by @chadlwilson in [#8453](#8453) ### 🚜 Refactor - prevent double-iteration when parsing idiomatic version files by @risu729 in [#8417](#8417) ### 🧪 Testing - **(tasks)** stabilize assertions and shell compatibility by @mackwic in [#8438](#8438) ### 📦 Registry - add tinygo ([aqua:tinygo-org/tinygo](https://github.com/tinygo-org/tinygo)) by @artemklevtsov in [#8446](#8446) ## 📦 Aqua Registry Updates #### New Packages (1) - [`kunobi-ninja/kunobi`](https://github.com/kunobi-ninja/kunobi)
## Summary - `mise env --redacted` only checked redactions from the non-tools env resolution pass (`config.env_results()`), missing any env vars declared with both `tools = true` and `redact = true` - The tools-only pass (`final_env` / `load_post_env`) correctly collects redactions, but `cli/env.rs` never queried them - Added `ts.final_env()` call to also collect tools-only redactions when building the `--redacted` filter Follows up on #8449 which fixed redaction in task output but missed the `mise env --redacted` display path. ## Test plan - [x] Added e2e test for `--redacted` with `tools = true, redact = true` (inline val) - [x] Added e2e test for `--redacted` with `_.source = { tools = true, redact = true }` - [x] Existing `test_env_redacted_flags` tests still pass - [x] Existing `test_task_redactions` tests still pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
tools = trueandredact = true, theredactflag was silently ignored — the plaintext value appeared in task outputtools = trueare resolved in a separate code path (load_post_env), and that path collected redactions but never applied them to the global redactorconfig.add_redactions()call afterload_post_envreturns infinal_envFixes #8432
Test plan
redact = true+tools = truecombinationtest_task_redactions,test_env_redacted_flags)🤖 Generated with Claude Code
Note
Medium Risk
Touches secret-redaction behavior and output handling, so a mistake could reintroduce leaks or over-redact logs, but the change is small and covered by an added e2e test.
Overview
Fixes an issue where environment variables resolved via the tools-only pass (
tools = true) were not having theirredact = truevalues registered with the global redactor, allowing secrets to appear inmise runoutput.Adds an e2e regression case covering the
tools = true+redact = truecombination, and updates the docs to clarify that redactions only work with non-rawtask output modes (with CI-friendlyMISE_TASK_OUTPUTexamples).Written by Cursor Bugbot for commit ad8919e. This will update automatically on new commits. Configure here.