The analysis of the security advisory and the associated commit a578ed58e478ba5c2dadf8d538ec5c3d39c28461 reveals an improper authentication vulnerability in Bytebase's GitLab login functionality. The root cause was that the authentication endpoint (/auth/gitlab) trusted client-provided parameters for the OAuth flow, including the ApplicationID, Secret, and InstanceURL.
The patch modifies the server/auth.go file to change this behavior. Instead of receiving the sensitive OAuth configuration from the client, the API now only requires a VCS provider ID. The server-side handler then uses this ID to look up the correct configuration from its own database (s.VCSService.FindVCS). This ensures that the authentication process always uses the server's trusted and pre-configured VCS settings.
The vulnerable function is the anonymous Go function that serves as the handler for the POST /auth/gitlab route, which is defined inside the Server.registerAuthRoutes method. During runtime, a profiler would identify this function in the call stack, likely with a name like Server.registerAuthRoutes.func1, when a user attempts to log in via GitLab. The exploitation of this vulnerability would involve sending a crafted request to this endpoint with malicious OAuth parameters.