Skip to content

Commit 5ec9989

Browse files
committed
Remove redundant 'openid' scope special case logic
The special case for adding 'openid' scope was redundant and could potentially bypass client scope restrictions. The main loop already correctly adds 'openid' to validScopes if it's in both requestedScopes and allowedScopes. Since 'openid' is already in the default scopes during client configuration (SyncClientsFromConfig), it will be available for clients that don't explicitly configure scopes. Clients can include or exclude 'openid' in their allowedScopes as needed. This ensures consistent enforcement of client scope restrictions with no special-case bypasses.
1 parent ad12110 commit 5ec9989

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

internal/service/oidc_service.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -323,22 +323,6 @@ func (oidc *OIDCService) ValidateScope(client *model.OIDCClient, requestedScopes
323323
}
324324
}
325325

326-
// Only include "openid" if it was requested AND it's in the client's allowed scopes
327-
// This respects client scope restrictions and doesn't bypass allowedScopes
328-
if contains(requestedScopesList, "openid") && contains(allowedScopes, "openid") {
329-
// Check if "openid" is already in validScopes (added by the loop above)
330-
hasOpenID := false
331-
for _, scope := range validScopes {
332-
if scope == "openid" {
333-
hasOpenID = true
334-
break
335-
}
336-
}
337-
if !hasOpenID {
338-
validScopes = append(validScopes, "openid")
339-
}
340-
}
341-
342326
return validScopes, nil
343327
}
344328

0 commit comments

Comments
 (0)