Require an explicit issuer in oidc mode - #35
Open
0bserver07 wants to merge 1 commit into
Open
Conversation
AuthConfig::default set issuer to https://accounts.google.com, so a config with mode = "oidc", an allowlist, an OAuth client and a session secret but no issuer passed config check and the server then ran discovery against Google, fetched Google's JWKS and validated every ID token as a Google identity (crates/walgit-server/src/auth.rs:150 and :777). The default is now an empty string, which the check at crates/walgit-config/src/lib.rs:1511-1515 rejects, so oidc mode fails closed until the operator names the issuer as AGENTS.md section 1.3 requires. That check sits inside the mode == Oidc arm opened at lib.rs:1502, so none and token mode are untouched. tests::auth_modes_validate_fail_closed proves it: a minimal oidc config without an issuer now fails on the issuer message, the two cases that used to ride on the Google default carry an explicit issuer, and two new assertions show none and token mode validate with the issuer empty. The walgit.example.toml comment near line 53 says the setting is required, and the ID token fixture in auth.rs sets the issuer it signs with. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
With
mode = "oidc"and noissuerset, the config passes validation and the server quietly useshttps://accounts.google.com, the default inAuthConfig::default. Discovery, the JWKS fetch and every ID token check then run against Google without anyone having asked for it, andwalgit.example.tomlshows the key commented out as if it were optional.This makes the default empty. The existing check (
server.auth.issuer must be an https URL ...) then rejects oidc mode until an issuer is named, which is the fail-closed behaviour AGENTS.md section 1.3 asks for. The check only runs in the oidc arm, sononeandtokenmode are untouched; the test asserts that too, and the example file now says the key is required.One behaviour change to know about: an oidc host that never set an issuer has been signing people in via Google and will now refuse to start until it names one. The error text says which key.
Checked with the built binary (a minimal oidc config fails without
issuer, passes with it),cargo test -p walgit-configandcargo test -p walgit-server --lib; the ID-token fixture inauth.rsnow sets the issuer it signs with. No browser sign-in against a live issuer was tried.Same pass as #25, #26, #27, #28, #29.