R83: DCR require client_secret for confidential auth, validate redirect_uri scheme; reject callback query/fragment

This commit is contained in:
2026-08-13 18:46:53 +01:00
parent 3c41fa717a
commit 0dfa2979bb
4 changed files with 131 additions and 4 deletions
+8
View File
@@ -421,6 +421,14 @@ func (c *Config) Validate() error {
if !strings.HasPrefix(c.CallbackURL, "/") {
return fmt.Errorf("callbackURL must start with /")
}
// The callback is matched by exact request-path comparison
// (req.URL.Path == redirURLPath) and used verbatim as redirect_uri. A
// query string or fragment in the path config part never matches the
// request path and corrupts redirect_uri (buildFullURL), causing an
// endless re-auth loop. Reject it at config time.
if strings.ContainsAny(c.CallbackURL, "?#") {
return fmt.Errorf("callbackURL must not contain a query string or fragment")
}
// Validate client credentials. With Dynamic Client Registration (RFC 7591)
// enabled, clientID (and typically clientSecret) are not known at