The vulnerability exists in the NewBasic function within the basic_auth.go file. The core of the issue is a logical error in how the notFoundSecret variable is initialized. This variable is crucial for preventing timing attacks during basic authentication. In the vulnerable versions, the code attempts to look up a secret from a map of users, but the key used for the lookup is derived from the map's values, not its keys. This results in notFoundSecret always being an empty string. Consequently, when an invalid username is provided, the goauth.CheckSecret function, which is supposed to perform a constant-time comparison, short-circuits because it receives an empty secret. This creates a significant and measurable difference in response time between requests with valid and invalid usernames, allowing an attacker to enumerate valid usernames. The patch, identified in commit 8c4fc89579d0410e2b312429a074ace50be3acca, corrects this by directly taking a value from the user map to use as the notFoundSecret. This ensures that a proper, non-empty secret is used in the comparison, thereby eliminating the timing discrepancy and closing the vulnerability.