The vulnerability occurs in OpenFGA when the check query cache is enabled and an authorization model contains a tuple cycle. Specifically, the Check and ListObjects APIs are affected. The provided commit 244302e7a8b979d66cc1874a3899cdff7d47862f modifies the internal/graph/cached_resolver.go file, specifically the ResolveCheck method of the CachedCheckResolver struct.
The vulnerability was that this ResolveCheck method would cache the response from the underlying resolver even if the response indicated that a cycle was detected (resp.GetCycleDetected()). A cycle means the result of the check is indeterminate at that point in the resolution. Caching such an indeterminate result (which might resolve to allowed: false due to the cycle) could then be served to subsequent identical Check or ListObjects requests (if ListObjects internally uses this check mechanism). This could lead to an authorization bypass if the true, fully resolved state (potentially by a parent check resolving differently due to the cycle information) should have been allowed: true.
The patch introduces a condition: if resp.GetCycleDetected() is true, the function logs the event and returns the response without saving it to the cache (c.cache.Set(...)). This ensures that indeterminate results due to cycles are not cached, forcing a re-evaluation by the underlying resolver for subsequent requests or allowing the calling context to correctly interpret the cycle. The primary vulnerable function identified is github.com/openfga/openfga/internal/graph.(*CachedCheckResolver).ResolveCheck because its previous behavior of caching cycle-detected results directly led to the vulnerability when used by the Check API (and potentially ListObjects API).