Skip to content

Require an explicit issuer in oidc mode - #35

Open
0bserver07 wants to merge 1 commit into
tobi:mainfrom
0bserver07:fix/oidc-requires-issuer
Open

Require an explicit issuer in oidc mode#35
0bserver07 wants to merge 1 commit into
tobi:mainfrom
0bserver07:fix/oidc-requires-issuer

Conversation

@0bserver07

Copy link
Copy Markdown

With mode = "oidc" and no issuer set, the config passes validation and the server quietly uses https://accounts.google.com, the default in AuthConfig::default. Discovery, the JWKS fetch and every ID token check then run against Google without anyone having asked for it, and walgit.example.toml shows 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, so none and token mode 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-config and cargo test -p walgit-server --lib; the ID-token fixture in auth.rs now sets the issuer it signs with. No browser sign-in against a live issuer was tried.

Same pass as #25, #26, #27, #28, #29.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant