Four different ways access control can fail. Each tab below isolates one CWE so you can focus on it. All four share the same root cause: the server trusts a user-supplied value to decide what data to return.
A "browse files" feature lists everything in a directory. Filenames alone leak backups, dotfiles, source code. Worse: the directory comes from the URL, so attackers peek wherever they like.
d = request.args.get('dir') or USER_DIR
return '\n'.join(os.listdir(d)) # no path check
List /tmp/demo/userfiles — public notes.
Change dir to /tmp/demo or /etc.