Skip to content

Ignore a local config's api_url and token until it is trusted - #226

Merged
robzolkos merged 3 commits into
masterfrom
local-config-trust
Nov 13, 2026
Merged

robzolkos merged 3 commits into
masterfrom
local-config-trust

Conversation

@robzolkos

@robzolkos robzolkos commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What

A local .fizzy.yaml keeps setting the account and the board. Its api_url and token now apply only once the file is trusted:

  • fizzy config trust [path] trusts the nearest .fizzy.yaml (or the one at path). It records a digest of the file's api_url and token, so changing either leaves the file untrusted until it is trusted again.
  • fizzy config untrust [path] removes the trust.
  • An untrusted file that sets either key prints one warning on stderr naming what was ignored and how to trust it.
  • fizzy setup trusts the local file it writes.
  • fizzy doctor warns when a local config's settings are being ignored, and config show / config explain report what actually applies.
  • With no profile chosen, the configured account names the stored credential. That credential now goes to its own profile's host rather than the host the YAML config or the default names. The host follows the credential: a profile with no token of its own does not change the host.
  • config trust and config untrust only change local trust records, so they run whatever the profile, account and token settings are.

Trust is stored in trusted-configs.json in the config directory (~/.config/fizzy), updated under a lock. SURFACE.txt is regenerated for the two new commands, and the README, AGENTS.md and the skill describe the behavior.

Why

A .fizzy.yaml is found by walking up from the working directory, so it often comes from a repository someone else wrote. The account and the board are harmless to take from it. The API host and the token decide where a credential is sent and which one, so those should be the person's own choice, made once per file.

Behavior change: an existing .fizzy.yaml that sets api_url or token stops applying them until fizzy config trust is run once in that directory. Files with only account and board are unaffected.

Testing

  • make check passes
  • Unit tests cover trust, untrust, a changed file losing trust, the warning, doctor, config explain, concurrent trust changes, and the profile host with and without a stored token.
  • Ran the built binary against local stand-in servers in an isolated home: an untrusted file's api_url and token are ignored and requests go to the configured host; after fizzy config trust they apply; after editing the file or fizzy config untrust they are ignored again.

A .fizzy.yaml is found by walking up from the working directory, so a
cloned repo supplies one. Its api_url and token were applied as written,
which let a repo choose the host a saved token is sent to.

An untrusted local config now sets only the account and the board. Its
api_url and token apply after `fizzy config trust`, which records a
digest of those two values: changing either leaves the file untrusted
until it is trusted again. `fizzy setup` trusts the local file it
writes, `fizzy config untrust` removes the trust, and doctor reports
ignored settings.

With no profile chosen, the configured account names the credential. A
stored profile's token now goes to that profile's own host rather than
the host the YAML config or the default names.
Copilot AI balanced review requested due to automatic review settings November 13, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

config explain incorrectly reports the selected profile API URL as <unset> when multiple profiles have no default, even though the account-named fallback profile’s host is in use.

1 open issue
What changed in this PR

Adds explicit trust for local .fizzy.yaml credential settings, preventing untrusted project files from overriding the CLI’s API URL or token while preserving account and board defaults.

Changes:

  • Adds digest-based trust storage and config trust / config untrust commands.
  • Integrates trust with setup, diagnostics, and configuration reporting; keeps account-selected credentials on their profile’s host.
  • Updates tests, documentation, and the CLI surface snapshot.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
SURFACE.txt Records the trust and untrust command surface.
skills/​fizzy/​SKILL.md Documents trust behavior and agent precautions.
README.md Explains trust requirements and invalidation.
internal/​config/​trust.go Implements trust-gated loading and trust storage.
internal/​config/​trust_test.go Tests trust, invalidation, revocation, and symlinks.
internal/​config/​config.go Applies trusted settings and warns about ignored keys.
internal/​config/​config_test.go Trusts fixtures that require local API URLs.
internal/​commands/​setup.go Automatically trusts the local config setup writes.
internal/​commands/​root.go Uses the account-selected profile’s API host.
internal/​commands/​doctor.go Reports ignored settings and profile-host attribution.
internal/​commands/​doctor_test.go Updates the local-token fixture for trust gating.
internal/​commands/​config_cmd.go Adds trust commands and filters explanation inputs.
internal/​commands/​config_cmd_test.go Tests trust commands, warnings, and profile-host fallback.
AGENTS.md Documents trust-aware loading requirements.

Review effort: Balanced

Comment thread internal/commands/doctor.go Resolved
Comment thread internal/commands/root.go Resolved
Comment thread internal/config/trust.go Resolved
Comment thread internal/commands/doctor.go Resolved
Comment thread internal/commands/config_cmd.go Resolved
Comment thread internal/config/trust.go Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 14 files

You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread internal/config/trust.go Resolved
Comment thread internal/commands/setup.go Resolved
Comment thread internal/commands/config_cmd.go Resolved
Comment thread internal/commands/config_cmd.go Resolved
Comment thread internal/config/trust.go Resolved
Comment thread internal/config/config.go Resolved
Comment thread skills/fizzy/SKILL.md Resolved
Comment thread internal/commands/config_cmd.go Resolved
Comment thread AGENTS.md Resolved
Comment thread internal/commands/doctor.go Resolved
The host of an account-named profile now follows its credential: it
applies only when that profile holds a token, so a token from another
source is not carried over to it. `config explain` shows that host as
the selected candidate, and shows what an untrusted local config sets
as ignored.

The trust store stays in the preferred config directory rather than
following the global config file, and its read, change and save run
under a lock with a temporary file of their own. `config untrust`
finds the entry of a file or link target that is gone.

`config trust` and `config untrust` run whatever the profile, account
and token settings are, skip the warning about the file they act on,
and report read and write failures as such rather than as usage
errors. `fizzy setup` fails when it cannot trust the file it wrote.
Paths in messages drop control characters.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 10 files (changes from recent commits).

You’re at about 93% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread internal/commands/root.go Resolved
Comment thread internal/commands/root.go Resolved
Comment thread internal/commands/config_cmd_test.go Resolved
Comment thread internal/config/trust.go Resolved
Comment thread internal/commands/config_cmd.go Resolved
Comment thread internal/commands/setup.go Resolved
Comment thread internal/commands/config_cmd_test.go Resolved
A token from FIZZY_TOKEN or --token replaces the account-named
profile's own, so it stays on the configured host as well.

A stale trust lock that cannot be removed no longer spins: the wait
runs to its deadline. `config explain` and `fizzy setup` drop control
characters from the local config's values and paths they print.
@robzolkos
robzolkos merged commit ca57305 into master Nov 13, 2026
16 checks passed
@robzolkos
robzolkos deleted the local-config-trust branch November 13, 2026 17:50
@robzolkos robzolkos added the bug Something isn't working label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants