The vulnerability exists because the MySQL database, when used as a datastore for OpenFGA, was configured with a case-insensitive collation by default. This caused identifiers (like usernames or object types) that only differed in case to be treated as the same. For example, user:Alice and user:alice would be considered identical. This could lead to improper authorization checks, where a user might be granted access they shouldn't have, or denied access they should have.
The fix for this vulnerability was to change the collation of the identifier columns in the MySQL database schema to utf8mb4_bin, which is a case-sensitive collation. This ensures that identifiers are compared in a case-sensitive manner, which is the expected behavior for OpenFGA.
The patch does not modify any Go code directly, but it changes the database schema. The vulnerable functions are the ones that interact with the database to read and write data, as their behavior is affected by the database's collation. The new test file pkg/storage/test/collation.go added in the patch explicitly tests the read paths (Read, ReadUserTuple, ReadChanges, ReadAuthorizationModel) to ensure they are now case-sensitive. The write paths (Write, WriteAuthorizationModel) are also included as they are responsible for storing the data that is later read.