The vulnerability lies in a common pattern across multiple view functions in the Weblate application. These functions were designed to fetch an object from the database using its primary key and then perform a permission check. The flaw in this logic is that if the object exists but the user does not have permission to view it, the server returns an HTTP 403 (Forbidden) error. If the object does not exist at all, the server returns an HTTP 404 (Not Found) error. This discrepancy, known as an observable discrepancy, allows an unauthenticated or low-privileged user to enumerate internal object IDs (like units, comments, changes, etc.) within private projects they should not have any knowledge of. By sending requests with different object IDs and observing the HTTP status code, an attacker can determine which IDs correspond to valid objects.
The patch, identified in commit 836bc082803d49d02f2831ec8339268eb66bcdae, fixes this by changing the lookup logic. Instead of fetching the object and then checking permissions, the fix first builds a queryset that is already filtered based on the user's access rights, and then attempts to retrieve the object from that restricted set. If the object is not in the accessible set (either because it doesn't exist or the user can't see it), the query returns no result, and the get_object_or_404 function correctly and consistently returns a 404 error, effectively hiding the existence of the object from unauthorized users.