FFFF Minor review findings from #4009 (credential approval and loadout services) · Issue #4062 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

Minor review findings from #4009 (credential approval and loadout services) #4062

Backlog

Description

@evanspearman

Minor findings from the review of #4009 that were unresolved when this issue was filed. Each links to its review comment. Tick an item when it is fixed or ruled out.

1. Name the action the user needs to migrate.

  • crates/client-config/src/config.rs:347 (comment)

An old action = "deny" rule gets the same message as action = "ask". The message lists both choices but does not tell the user which one to put in user_policy.toml. Include the actual action in the migration instructions so the user can preserve the existing decision. Keep the separate removal-only instructions for allow.

2. Preserve every generated grant's principal.

  • crates/mfile/src/expand.rs:1391 (comment)

If loadout a names github and loadout b names anthropic-oauth-token, both grants enter spec["secrets"]. However, or_insert keeps only a as the origin. report.principals(root)["secrets"] then omits b.
Track each generated grant's origin and include all contributing principals. Preserve the existing single-contributor results.

3. Recheck the link after creating the folder.

  • crates/minimal/src/client_file.rs:240 (comment)

replace checks for a symlink before create_dir_all runs. If the path contains .. after a folder that does not exist, the check cannot resolve the path and does not see a link. create_dir_all then creates that folder. The path now reaches the existing symlink, and persist renames the new file over the link itself. The documented behavior is that the write goes to the link's target and keeps the link.
The trigger needs a config directory such as --config-dir missing/../dir, where dir/config.toml is a symlink. The config path builders add fixed file names, so the default config locations do not produce this path.
Compute the target and run the link check after create_dir_all. Use that target for the temporary file and for persist. After the folder exists, target_of(path) follows the link to its file, so the write keeps the link. A chain that is still a link after resolution stays refused.

4. Task loadout egress lists disappear from min box spec without a reason.

  • crates/minimal/src/cmd/box_spec.rs:1539 (comment)

For a task entry, min task run does not apply a selected loadout's allow_subnets or allow_dns_hosts. The task branch in expand_entry never calls resolve_loadout_network. The omission loop records these lists only when the box has no network or --deny-all-egress is set, or for a host_ip box's hostnames. With own_ip, or with host_ip and subnets, the loadout's lists are dropped and no LeftOut entry is added. The rendered spec then shows neither the subnet nor why it is absent.
Each dropped loadout list needs an entry in left_out with a reason, as BCLI-088 requires. If tasks are meant to apply loadout egress lists, the task branch must resolve them the same way the box branch does.

5. Preserve the error from reading the user configuration.

  • crates/minimal/src/cmd/secret.rs:549 (comment)

The fallback now refuses when it cannot read the rules. Keep that refusal, but add the command message with with_context instead of interpolating {e} into a new error. The current conversion discards the original error chain. Based on learnings, the Rust coding standard says: “Preserve the source chain. Wrap, don't replace; errors trace back via source().”
Source: Learnings

6. The retired --preset guidance does not give a working retry for legacy item names.

  • crates/minimal/src/cmd/secret.rs:3279 (comment)

For an item named claude, min secret set claude --preset anthropic prints "Run the command again with --service anthropic-oauth-token". Running that command with the same item ID fails. refuse_service_args requires the item ID to match the service name (crates/minimal/src/cmd/secret.rs:331). The next refusal names the complete command. The original guidance does not name the item change. The parser cannot add the item ID, because refuse_preset receives only the preset value.
The test fixture uses anthropic-oauth-token as the item ID, so it cannot detect this case. Make the retired-flag guidance give a retry that passes the ID check when the item name differs. Add a case with a legacy item name.

7. Do not print a second [credential-rules] header.

  • crates/minimal/src/credential_approval.rs:396 (comment)

If user_policy.toml already has [credential-rules] with only action_for_unspecified = "ask", rule_lines prints a second header because there is no rules array. Pasting the suggested edit makes the file invalid TOML. Distinguish an absent table from an existing table without rules. For the latter, tell the user where to add only the rules assignment. (github.com)

8. Only suggest --no-loadouts when it removes every alias for the credential.

  • crates/minimal/src/credential_approval.rs:641 (comment)

If a project declares NPM_TOKEN and a loadout supplies NPM_ALIAS for the same store item, approval groups the aliases together. The refusal then promises that --no-loadouts removes the credential, but NPM_TOKEN still requires approval. Only show that remedy when all aliases come from loadouts. Update the mixed-attribution test to check that it does not promise removal.

9. Task runs drop deferred client-file lines on every exit.

  • crates/minimal/src/main.rs:264 (comment)

min task run defers the lines for a remembered credential answer that did not save. The task exit then skips the only drain on this path. The user sees the task's status but not the lines to add to the policy file. The approval is not saved, and the next run asks again without an explanation.
Drain the queue on both exit branches. The TaskExit branch returns before the failure printer, and the success path returns without any drain.

10. Credential approval runs before the daemon refuses brokered secrets on task runs.

  • crates/minimal/src/task.rs:1769 (comment)

With a serving proxy, the pre-check at line 1727 passes a brokered [secrets] grant. The approval at line 1733 then asks the user about that grant and can save the answer. CreateSession at line 1782 sends no proxy root certificate, so the daemon refuses the create. The user is prompted for a credential the task cannot use, and a remembered approval can outlive the refused run.
Refuse brokered secrets on the task run before approve_spec_secrets runs, under the same condition the daemon applies to a request with no certificate. The check at line 1727 covers only the no-proxy case, so it does not cover this one.

11. Tell users how to fix malformed values for supported keys.

  • crates/mfile/src/error.rs:662 (comment)

If a loadout sets allow_subnets = "10.0.0.0/8", expansion uses LoadoutNetworkKey and tells the user to remove network.egress.allow_subnets. The key is valid. The value must be a list of strings. Report wrong shapes separately and reserve the removal advice for unsupported keys.

12. Name the loadout that sets a variable that conflicts with a sealed secret.

  • crates/mfile/src/expand.rs:1096 (comment)

When the project declares a sealed secret TOKEN and a loadout sets env_vars.TOKEN, the refusal at crates/mfile/src/expand.rs:1094-1104 reports the plain delivery as [env_vars]. The error type OneNameTwoDeliveries is not in the list of loadout variants that Error::is_in_project_file treats as not project-file errors (crates/mfile/src/error.rs:353-382), so it blames the project file. The user is sent to minimal.toml and is not told which loadout to edit. The run still refuses with exit 3, so the defect is in the diagnostic only.
The same literal appears at crates/mfile/src/expand.rs:1141-1146, where a grant derived from network.uses conflicts with a loadout-set variable. Both sites need the same correction.
Name the layer from expansion.report.env_vars in both places. For a loadout-set variable, the plain delivery should name that loadout. Keep the project-file classification when both declarations come from the project file. Make the error's file classification depend on the layer that delivers the plain value, not on the variant alone.

13. Assert that the store override produces a report [REDACTED].

  • crates/mfile/src/expand.rs:6929 (comment)

all() passes if derived_grants is empty. The test would still pass if the declared item stayed in the spec but the report lost the override. Assert the expected [REDACTED], including the variable, service, and declared_instead: true, as the broker override test does.

14. Keep network principals aligned with the final spec.

  • crates/minimal/src/cmd/box_spec.rs:1352 (comment)

If a project sets network.mode = "own_ip" and the user runs min box spec <entry> --network none -o json, the final mode and source reflect the flag, but principals["network.mode"] still names the project. Removed keys such as network.uses can also retain principal entries. Update principals when the renderer replaces or removes the corresponding source. Keep the project principal when the project's mode survives.

15. Account for hosts from accepted loadout services in the task preview.

  • crates/minimal/src/cmd/box_spec.rs:1428 (comment)

An open own_ip task can accept a loadout that names only claude-code. Expansion records the service as accepted, but the task branch resolves only the project's uses. The rendered spec contains neither the service's hosts nor a reason for their omission. Resolve the accepted services if task creation supports them. Otherwise, mark them as left out before deriving any grants. Reporting omitted explicit egress lists does not fix this service-only case.

16. A package-only preview fails on an approval read it does not use.

  • crates/minimal/src/cmd/box_spec.rs:1691 (comment)

min box spec reads the credential approval tables for every entry, before it checks whether the entry has any credential. An organization client configuration that exists but does not parse, or that has an invalid [credential-rules] table, makes read_tables fail. The earlier client configuration read accepts an unparseable organization file and only prints a diagnostic. The preview therefore refuses an entry that has no credential, where it rendered before this change.
Read the approval tables only when a credential grant exists. Move the read_tables call behind the same check that decides whether a credential is present, so an entry without credentials does not read them.

17. The stored spec is rebuilt from the project after approval.

  • crates/minimal/src/cmd/boxes/create.rs:6485 (comment)

Credential approval and the minted grants use the snapshot taken during the checks. put_session_entry and stamp_session_spec_with expand the project again from disk when the create request is built. A project edit during the approval prompt can therefore make the stored spec declare credentials that were never approved or minted, or omit ones that were.
Build the stored spec from the expansion that approval checked. Alternatively, recheck approval against the fresh expansion before the create request is sent.


This is a residual of epic #1501 (BEP).

Activity

  1. added
    bug
    on Dec 4, 2026
  2. added
    priority:nice-to-have
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:nice-to-have

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0