The vulnerability lies in the convert.ToStopWatches function, which was responsible for converting stopwatch data for API responses. This function failed to perform authorization checks to verify if the user making the request had the necessary permissions to view the repositories and issues linked to the stopwatches. As a result, users whose access to a private repository had been revoked could still see issue titles and repository names through API endpoints that exposed stopwatch information.
The patch addresses this flaw by modifying the convert.ToStopWatches function to accept the user performing the action (the 'doer') as an argument. It then introduces a permission check (access_model.GetUserRepoPermission) within the function to ensure the user has read access to the repository before including its stopwatch data in the response. Consequently, the API and web endpoints (repo.GetStopwatches and user.GetStopwatches) that use this function were updated to pass the current user's context. Additionally, the fix includes proactive measures to delete a user's stopwatches for a repository (issues_model.RemoveStopwatchesByRepoID) when their collaboration or team membership is revoked, preventing stale data from being accessed.