Repository navigation
feat: T138 — min box spec warns, on stderr, about an env_vars variable whose name looks like a secret's - #3776
Conversation
The expansion report carries one warning for each kept env_vars variable whose name contains a secret-like part (BOX-231), with the layer and file whose value survives the merge. The value stays in the spec as written (BOX-230).
Each env_vars name that the expander flags as secret-like prints one warning line on stderr (BCLI-084). Stdout stays the spec in every -o format, and no other command prints the warning.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
|
Reviewed: no findings; approval withheld, 5 threads unresolved at APPROVE withheld: 5 unresolved threads — minimal-foundry[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs:1036, minimal-arch[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs:1036. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
| f, | ||
| "A box from this entry stores its value as written in the box's spec. \ |
There was a problem hiding this comment.
LOW · printed-text · confidence 0.55
The warning says the box stores the value as written. That is false for an inherit = true variable such as GITHUB_TOKEN = { inherit = true }. The spec stores the inherit table and not the host value. The user gets told to move a variable into [secrets] when it holds no secret. Say "as written" only for a literal value, or word the text for the inherit case.
What the reviewer checked
resolve_var: Table with inherit=true resolves from host; merge_vars stores var.value (the table) in spec; secret_name_warnings does not check the value shape.
Hand this to an agent
Act on a code-review finding.
File: crates/mfile/src/expand.rs
Lines: 263-264
Category: printed-text
Severity: low (reviewer confidence 0.55)
Finding:
The warning says the box stores the value as written. That is false for an `inherit = true` variable such as `GITHUB_TOKEN = { inherit = true }`. The spec stores the inherit table and not the host value. The user gets told to move a variable into `[secrets]` when it holds no secret. Say "as written" only for a literal value, or word the text for the inherit case.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Tracked in #3778: the warning should apply only to a variable whose kept value is a literal, since an inherit = true variable's spec holds the inherit table, not the host value. Narrowing it is a BOX-231 change (spec 29) first, so it does not hold this PR, which implements BOX-231 as written.
There was a problem hiding this comment.
Addressed in 19be5694269c: SecretNameWarning now records the value shape. For { inherit = true } with no default, the text says the spec stores { inherit = true } and not a value, with no [secrets] advice. An inherit with a default says its default is stored as written. The test pins both texts.
…ec-warns-on-stderr-about-an-env-vars-v
An inherit with no default stores { inherit = true } in the spec, not a
value, so the warning no longer says the value is stored as written.
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The expander finds secret-like env_vars names and keeps the value as written. Only min box spec prints the warning, on stderr. This conforms to architecture.md lines 81, 336 and 1294. One gap is not named: min box start stores a loadout's GITHUB_TOKEN (create.rs line 2298), but min box spec does not fold loadouts and prints no warning for it. That is the #3210 case. Do C1: list #3236 as a residual in the PR body, and correct the note that says no path sets Layers.loadouts.
Ruled at b875966 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
| // same read. | ||
| let (expansion, read_rules) = expand_with_store_rules(Some(global), entry, &mut layers)?; | ||
| let store_ids = store_reference_ids(&expansion.spec); | ||
| let secret_name_warnings = expansion.report.secret_name_warnings.clone(); |
There was a problem hiding this comment.
C1 · This copy holds no loadout warning. expand_entry does not fold the selected loadouts (#3236). min box start folds them at create.rs line 2298, so the record stores a loadout's secret-like value with no warning. Architecture.md line 1294 says the min box spec render is what the host receives. List #3236 as a residual in the PR body (C1).
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Converted to a draft: verify exited 100. Review threads the coder judged:
min box spec dev on a project whose loadout sets env_vars.GITHUB_TOKEN = "x" prints the secret-name warning on stderr, prints the spec with GITHUB_TOKEN = "x" on stdout, and exits 0. Only min box spec prints the warning, so min session start prints no such line. For a { inherit = true } variable with no default, the warning now says the spec stores { inherit = true } and not a value. Notes from the agent: Revise round 1 changed only crates/mfile/src/expand.rs. SecretNameWarning gains a |
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-foundry[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs:1036. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
|
/arch-review |
There was a problem hiding this comment.
arch-review: CONDITIONS · 3 conditions · the full ruling
C1 from the last ruling is still open. The PR body still lacks the #3236 residual, and it keeps Closes #3210. The new StoredVar::Inherit arm returns before the [secrets] sentence. BOX-231 and BCLI-084 require every warning to name [secrets], and arch line 81 makes [secrets] the place for secrets. Make the change in C2. The inherit text correctly does not say a value is stored. State that departure from the spec wording in the #3778 residual (C3).
Ruled at 19be569 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
| f, | ||
| "A box from this entry stores its value as written in the box's spec. " | ||
| )?, | ||
| StoredVar::Inherit => { |
There was a problem hiding this comment.
C2 · This arm returns before the [secrets] sentence. BOX-231 and BCLI-084 require every warning to name [secrets]. Remove the return and fall through to the last write!, as the other arms do.
There was a problem hiding this comment.
Addressed in 69cf26c289a6: C2: commit 69cf26c removes the early return in the Inherit arm, so the warning falls through to the [secrets] sentence like the other arms.
| StoredVar::Inherit, | ||
| "the variable GH_TOKEN in `env_vars` has a name that looks like a \ | ||
| secret's. `[sessions.dev]` in minimal.toml sets it. The box's spec \ | ||
| stores `{ inherit = true }` for it, not a value." |
There was a problem hiding this comment.
C2 · Add the [secrets] sentence to the end of this expected GH_TOKEN text after the C2 change.
There was a problem hiding this comment.
Addressed in 69cf26c289a6: C2: commit 69cf26c adds the [secrets] sentence to the end of the expected GH_TOKEN text. credential_like_env_var_name_warns passes.
| // same read. | ||
| let (expansion, read_rules) = expand_with_store_rules(Some(global), entry, &mut layers)?; | ||
| let store_ids = store_reference_ids(&expansion.spec); | ||
| let secret_name_warnings = expansion.report.secret_name_warnings.clone(); |
There was a problem hiding this comment.
C1 · These warnings come from an expansion that does not include the selected loadouts. min box start includes them (create.rs line 2298). List that gap as a residual with #3236 in the PR body.
|
/revise Arch ruling CONDITIONS on 19be569. C1 and C3 are PR-body edits, already made by hand; do not change the body's
Reply to each arch thread with the commit that meets it. |
…ec-warns-on-stderr-about-an-env-vars-v
The Inherit arm returned early and skipped the [secrets] sentence that every other warning prints. BOX-231 and BCLI-084 require it in every warning.
|
Round 2 of 10 on a /revise note, pushed as
Verify Converted to a draft: verify exited 100. Review threads the coder judged:
min box spec dev on a project whose loadout sets env_vars.GITHUB_TOKEN = "x" prints the warning line on stderr and the spec with GITHUB_TOKEN = "x" on stdout, and exits 0. min session start prints no such line. Every warning now ends with the [secrets] sentence, the inherit = true case included. Notes from the agent: Round 2 applies C2 in commit 69cf26c. The StoredVar::Inherit arm no longer returns early, so its warning ends with 'Put a secret value in a |
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 5 unresolved threads — minimal-foundry[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs:1036, minimal-arch[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/mfile/src/expand.rs, minimal-arch[bot] crates/minimal/src/cmd/box_spec.rs:1036. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The edit at this head meets C2. Every secret-name warning, including the { inherit = true } case, now names [secrets], as architecture.md line 81 requires. The PR body meets C1 and C3. It lists the #3236 loadout gap and the #3778 wording interim as residuals. The store.rs changes in the compare come from #3777 through the merge from main. This ruling does not cover them. No condition stays open.
Ruled at 69cf26c against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
T138 — min box spec warns, on stderr, about an env_vars variable whose name looks like a secret's
slice: S5
kind: task
covers: BOX-230, BOX-231
size: S
est: 80 code, 140 tests
executor: agent
difficulty: routine
model: strong
diagnostics: min box spec prints one stderr line per variable that BOX-231 flags; stdout stays the spec under -o json and -o yaml
observability: the expander's report carries the flagged variable names and the layer and file of each surviving value
layers:
- expand:
- crates/mfile/src/expand.rs: ExpansionReport gains secret_name_warnings, one per variable that BOX-180's merge keeps whose name contains, ignoring ASCII case, TOKEN, SECRET, PASSWORD, PASSWD, API_KEY, APIKEY, PRIVATE_KEY or CREDENTIAL (BOX-231). Each holds the variable name and the layer and file whose value survives the merge (layer_words). The expansion continues, and the value is stored as written (BOX-230)
test: cargo nextest run -p mfile credential_like_env_var_name_warns
test: cargo nextest run -p mfile loadout_env_var_literal_stored_as_written
- cli:
- crates/minimal/src/cmd/box_spec.rs: entry_spec prints each secret_name_warning on stderr (BCLI-084, spec 28); no other command prints them
- crates/minimal/tests/cli.rs: adds the test below: min box spec on an entry whose loadout sets GITHUB_TOKEN as a literal checks the exact stderr line and that -o json stdout parses
test: cargo nextest run -p minimal box_spec_entry_prints_secret_name_warnings_on_stderr
produces: none
consumes: none
proof: min box spec dev on a project whose loadout sets env_vars.GITHUB_TOKEN = "x" prints the warning line on stderr and the spec with GITHUB_TOKEN = "x" on stdout, and exits 0; min session start on the same project prints no such line.
User-facing text
The exact line
min box spec <entry>prints on stderr, once per flagged variable, pinned inbox_spec_entry_prints_secret_name_warnings_on_stderr:warning: env_vars.<NAME>, set by <layer> (<file>), looks like a secret. Its value is stored in the box record as written. Put a secret in [secrets] to keep its value out of the record.<layer>is the words the expander already uses for a layer (for examplethe loadout dev), and<file>is that layer's file. Why it is true: BOX-230 stores the merged value as written, and only a[secrets]entry keeps a value out of the spec (BOX-080). Requirements: BOX-230 and BOX-231 (spec 29, #3756), BCLI-084 (spec 28, #3760).This task implements the fix tracked in #3210, which is closed by hand when the PR merges.
Proof
min box spec dev -o json on a project whose [sessions.dev] sets env_vars.GITHUB_TOKEN = "x" exits 0. It prints one warning line on stderr that names GITHUB_TOKEN and the layer that sets it, says that the box stores the value as written, and names [secrets]. Stdout is the spec as JSON with GITHUB_TOKEN = "x". The expander gives the same warning, with the loadout name and file, for a loadout layer. No command other than min box spec prints the warning. The loadout half of the proof is not true through min box spec today, and the notes say why.
Notes from the agent: Gap in the proof: min box spec does not fold the selected loadouts into its expansion. Layers.loadouts stays empty in expand_entry, and the code comment there says 'Folding their values into the spec is #3236'.
min box startdoes setLayers.loadouts(crates/minimal/src/cmd/boxes/create.rsaround line 2298 setswhole.loadouts), butmin box spec'sexpand_entrydoes not. So a GITHUB_TOKEN that only a loadout file sets is stored bymin box start, but does not reach the spec thatmin box specprints, and no warning prints for it (#3236). The expander side does handle loadouts: credential_like_env_var_name_warns and loadout_env_var_literal_stored_as_written pass loadout layers, with a file path, directly. When #3236 folds the loadouts in, the CLI prints their warnings with no further change. I did not fold the loadouts into box_spec.rs here, because that changes the stdout of every min box spec (the built-in default loadout adds MINIMAL_MOTD, PROMPT_COMMAND and PS1) and it is the work of #3236 and BCLI-077. For this reason the CLI test sets GITHUB_TOKEN = "x" in [sessions.dev] in minimal.toml, not in a loadout file, as the task described. Printed text: the task and spec give no exact wording, so I wrote it. It is pinned in both tests: 'warning: the variable GITHUB_TOKEN inenv_varshas a name that looks like a secret's.[sessions.dev]in minimal.toml sets it. A box from this entry stores its value as written in the box's spec. Put a secret value in a[secrets]entry to keep it out of the spec.' For a loadout with a file, the second sentence is 't…[truncated]Tests
cargo nextest run -p mfile credential_like_env_var_name_warnscargo nextest run -p mfile loadout_env_var_literal_stored_as_writtencargo nextest run -p minimal box_spec_entry_prints_secret_name_warnings_on_stderrVerify
min task run agent-verifyexited 100, so this PR is a draft.Closes #3770
Closes #3210
Residuals
min box specdoes not fold the selected loadouts into its expansion, so it prints no BOX-231 warning for a variable that only a loadout sets, thoughmin box startstores that value (crates/minimal/src/cmd/boxes/create.rsline 2298 setswhole.loadouts). BCLI: the stored spec records the loadouts --loadout selects (T11 residual, arch C1) #3236.{ inherit = true }with nodefault, the warning says the spec stores{ inherit = true }, not that a value is stored as written. That departs from the BOX-231 and BCLI-084 wording until min box spec: don't warn about an inherit = true variable whose name looks like a secret's #3778 amends them.