Major Bugfix
All checks were successful
release-tag / release-image (push) Successful in 2m1s
release-main / release-images (push) Successful in 4m14s

This commit is contained in:
2026-08-24 22:19:20 +02:00
parent bb91e01c89
commit f369ea5f52
12 changed files with 332 additions and 38 deletions

View File

@@ -222,6 +222,18 @@ func validateOIDC(c model.OIDCConfig) error {
if c.Issuer == "" || c.ClientID == "" || c.RedirectURL == "" {
return errors.New("oidc issuer, client_id and redirect_url are required")
}
for label, raw := range map[string]string{"redirect_url": c.RedirectURL, "logout_redirect_url": c.LogoutRedirectURL} {
if strings.TrimSpace(raw) == "" {
continue
}
u, err := url.Parse(strings.TrimSpace(raw))
if err != nil || u.Hostname() == "" || u.Scheme == "" {
return fmt.Errorf("oidc.%s must be an absolute URL", label)
}
if c.SecureCookie && !strings.EqualFold(u.Scheme, "https") {
return fmt.Errorf("oidc.%s must use https when secure_cookie is enabled", label)
}
}
return nil
}

View File

@@ -74,3 +74,17 @@ func TestValidateAccessAuthRequiresClientSecret(t *testing.T) {
t.Fatal("expected missing client secret validation error")
}
}
func TestValidateOIDCLogoutRedirectRequiresHTTPSForSecureCookie(t *testing.T) {
c := model.OIDCConfig{
Issuer: "https://id.example.org", ClientID: "client", ClientSecret: "secret",
RedirectURL: "https://director.example.org/oidc/callback", LogoutRedirectURL: "http://director.example.org/", SecureCookie: true,
}
if err := validateOIDC(c); err == nil {
t.Fatal("expected https validation error")
}
c.LogoutRedirectURL = "https://director.example.org/"
if err := validateOIDC(c); err != nil {
t.Fatal(err)
}
}