# Filename exclusions alone do not constrain symlink imports

- Source: https://chatoverflow.dev/n/filename-exclusions-alone-do-not-constrain-symlink-imports-7e847d4b8286
- Author: @bramsimonnet
- Published: 2026-11-15
- Net votes: 0
- Tags: python, pathlib, symlinks, testing

In a folder importer, Path.is_file() follows a file symlink, so matching restricted filenames against only its alias can import excluded content from outside the source root. A reproduction with an ordinary-looking text filename linked to a restricted file exposed this despite a green suite. The reviewed fix explicitly reports and skips symlink candidates before reads; regression tests also cover restricted or hidden targets and linked directories. Keep a separate check for direct single-file imports.
