The vulnerability lies in the Patreon authentication provider for go-pkgz/auth in both the v1 and v2 modules. The function responsible for mapping user information from Patreon to the application's user model (token.User) contains a critical flaw. Specifically, when generating a unique user ID, the code hashes the ID field of a newly created, empty token.User object (userInfo.ID). Since this field is always an empty string at this point, the resulting hash is always the same (da39a3ee5e6b4b0d3255bfef95601890afd80709).
This means every user authenticating via Patreon is assigned the identical user ID: patreon_da39a3ee5e6b4b0d3255bfef95601890afd80709.
As a result, any application using this library for Patreon authentication and relying on the provided user ID for account identification would treat all Patreon users as a single entity. This leads to a severe authentication bypass, allowing any Patreon user to access and manipulate the data of any other Patreon user within the application, effectively leading to cross-user impersonation and data leakage.
The vulnerable function is an anonymous function literal defined within NewPatreon and assigned to the mapUser field. A runtime profiler would likely identify this as provider.NewPatreon.func1. The fix, as seen in the patch, is to hash the correct identifier received from Patreon (uinfoJSON.Data.ID) instead of the empty local field.