Skip to content

fix(auth): tolerate string booleans in oidc provider config - #2606

Merged
kolaente merged 2 commits into
mainfrom
fix-2599-oidc-env-bool
Apr 11, 2026
Merged

fix(auth): tolerate string booleans in oidc provider config#2606
kolaente merged 2 commits into
mainfrom
fix-2599-oidc-env-bool

Conversation

@tink-bot

Copy link
Copy Markdown
Collaborator

The four OIDC provider boolean fields (emailfallback, usernamefallback, forceuserinfo, requireavailability) were parsed with a strict .(bool) type assertion, which fails whenever config arrives as strings — i.e. from environment variables or the *.file Docker secret convention (both flow through GetConfigValueFromFile which always returns strings). requireavailability is the one #2599 reports.

Extract a small parseBoolField helper that accepts both native bools and strings via strconv.ParseBool.

Bonus fix: the same bug was silently dropping stringified emailfallback / usernamefallback values with no log at all — those two call sites had no else branch. They now log a parse error from the shared helper's code path, matching the other two fields.

Fixes #2599

Regression test for #2599. Exercises getProviderFromMap with native
bools and with stringified booleans ("true"/"false"/"1"/"0") for all
four boolean provider fields — emailfallback, usernamefallback,
forceuserinfo, requireavailability. From env vars and from the
GetConfigValueFromFile path every leaf arrives as a string, so the
current .(bool) assertion silently zeros these fields.
The four boolean OIDC provider fields (emailfallback, usernamefallback,
forceuserinfo, requireavailability) were parsed with a strict .(bool)
type assertion. That works for YAML/JSON config where leaves are native
bools, but fails for every other input path: env vars always arrive as
strings, and GetConfigValueFromFile (used by the *.file Docker secret
convention) also always returns strings. The assertion would silently
zero the field for emailfallback and usernamefallback, and log an error
and zero the field for forceuserinfo and requireavailability, which is
what #2599 reports.

Extract a small parseBoolField helper that accepts both native bools and
strings (via strconv.ParseBool) and logs a parse error from each call
site. This also fixes the previously-silent drop of stringified
emailfallback / usernamefallback values — those now log an error if the
input is garbage, matching the behaviour of the other two fields.

Fixes #2599
@github-actions github-actions Bot added area/auth Login, OIDC, LDAP, SAML, TOTP/2FA, PKCE, SCIM, sessions, password area/config config.yml, env vars, runtime flags, deployment config labels Apr 11, 2026
@kolaente
kolaente enabled auto-merge April 11, 2026 19:03
@github-actions

Copy link
Copy Markdown

Preview Deployment

Preview deployments for this PR are available at:

URL Tag Commit
https://pr-2606.preview.vikunja.dev ghcr.io/go-vikunja/vikunja:pr-2606 latest
https://sha-a11abb46b4732a26106f0f9b84fe80c2eb5baf01.preview.vikunja.dev ghcr.io/go-vikunja/vikunja:sha-a11abb46b4732a26106f0f9b84fe80c2eb5baf01 a11abb4

The preview environment will start automatically on first visit. Subsequent pushes to this PR will update the pr-2606 image — the preview picks up the new version on restart. The per-commit URLs point to a specific version and will not change.

Run locally with Docker
docker pull ghcr.io/go-vikunja/vikunja:pr-2606
docker run -p 3456:3456 ghcr.io/go-vikunja/vikunja:pr-2606

Last updated for commit a11abb4

@kolaente
kolaente added this pull request to the merge queue Apr 11, 2026
Merged via the queue into main with commit ced7ebd Apr 11, 2026
38 checks passed
@kolaente
kolaente deleted the fix-2599-oidc-env-bool branch April 11, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Login, OIDC, LDAP, SAML, TOTP/2FA, PKCE, SCIM, sessions, password area/config config.yml, env vars, runtime flags, deployment config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid value of requireavailability when reading for env var

2 participants