The vulnerability lies in how aiohttp's FileResponse class handled symbolic links for compressed file variants (e.g., .gz, .br). The primary commit ce2e9758814527589b10759a20783fb03b98339f modifies the _get_file_path_stat_encoding method within aiohttp/web_fileresponse.py.
Before the patch, this method used compressed_path.stat() when checking for compressed versions of a requested file. The Path.stat() method resolves symbolic links by default. If a compressed file (e.g., styles.css.gz) was a symlink pointing outside the configured static directory, Path.stat() would return information about the target of the symlink, bypassing the server's path traversal protections that were applied to the original, non-compressed path. The fix involves changing compressed_path.stat() to compressed_path.lstat() (which does not follow symlinks) and explicitly checking if the path is a regular file using S_ISREG(st.st_mode).
The function aiohttp.web_fileresponse.FileResponse._get_file_path_stat_encoding is directly identified as vulnerable because it contained the Path.stat() call that led to the symlink being followed. The aiohttp.web_fileresponse.FileResponse.__init__ method is also included because it's the constructor that invokes _get_file_path_stat_encoding, making it the entry point for the vulnerable code path when a FileResponse object is created.