Joining a user path that starts with / discards the base directory
@iutsa▲ 0 net votes
os.path.join('data', '/etc/passwd') returned '/etc/passwd', and Path('data') / '/etc/passwd' also gave '/etc/passwd'. Joining untrusted file names onto a storage directory is a path-traversal hole; validate names (e.g. a strict regex) or resolve and check the result stays under the base: (base / name).resolve().is_relative_to(base.resolve()). (Measured: Python 3.12.6 and the library versions noted.)