Accept a static token entry that names only token_env - #26
Open
0bserver07 wants to merge 3 commits into
Open
Conversation
StaticToken.token at crates/walgit-config/src/lib.rs:212 carried no serde default while token_env on the next line did, so an entry that named only an environment variable failed to deserialize with "missing field token". Every shipped example writes that shape, including README.md:19, walgit.example.toml:48 and walgit.standalone.toml:36, so the quick start config was rejected by "walgit --config walgit.toml config check". The field now defaults to the empty string, and Config::validate at lib.rs:1491 still refuses an entry that names neither token nor token_env, so a config with no way in stays fail-closed as GOAL.md asks. tests::auth_modes_validate_fail_closed parses the README entry and asserts the entry with neither form still errors; it fails on the old struct with the same TOML parse error the binary printed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The header comment at walgit.example.toml:6 said "walgit config check walgit.toml", but the check subcommand takes no positional argument and running it that way prints "error: unexpected argument 'walgit.toml' found" and exits 2. The path comes from the global --config flag declared at crates/walgit-cli/src/lib.rs:42-48, so the comment now reads "walgit --config walgit.toml config check". I ran that form against walgit.example.toml and walgit.standalone.toml with the built binary and both print "config OK". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The auth mode table at README.md:143 described mode none as everyone being anon with write, which understates what the mode does. AuthMode::None returns a principal with write true and admin true at crates/walgit-server/src/auth.rs:672-677, and AGENTS.md:78 states the same in the security contract, so a reader of the README alone would not know that a loopback run also hands out settings and policy.json writes. The row now says write and admin. This is a documentation correction with no code change, so the code cited above is the proof. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22 (thanks @jeonck, same diagnosis).
The README quick-start config doesn't load.
StaticToken.tokenincrates/walgit-config/src/lib.rshas no#[serde(default)]whiletoken_envdoes, so an entry that only names an environment variable dies in serde withmissing field tokenbeforevalidate()gets a look. Every shipped example oftoken_env(README.md,walgit.example.toml,walgit.standalone.toml) hits it.Three commits:
auth_modes_validate_fail_closedwith the README entry, plus an entry that names neither key so the fail-closed path stays covered (validatealready refuses it).walgit.example.tomltold you to runwalgit config check walgit.toml, which exits 2 because the path is the global--configflag; it now sayswalgit --config walgit.toml config check.nonegives write; it gives admin too.Checked with the README block written to a file:
config checkprintsmissing field tokenon main andconfig OKwith this.cargo test -p walgit-configpasses.