Skip to content

Resolve symlinks when checking backend-path containment - #242

Open
blouirts123 wants to merge 1 commit into
pypa:mainfrom
blouirts123:fix/resolved-backend-path
Open

blouirts123 wants to merge 1 commit into
pypa:mainfrom
blouirts123:fix/resolved-backend-path

Conversation

@blouirts123

Copy link
Copy Markdown

norm_and_check() accepts a relative backend directory whose symlink target is outside the source tree. This lets a project unintentionally depend on an external directory despite the helper's in-tree path check.

Resolve both the source root and requested backend path for containment checks, while continuing to return the original normalized absolute path. This preserves valid in-tree links and source roots accessed through a link. It follows PEP 517's recommended frontend check for self-contained source trees: https://peps.python.org/pep-0517/#in-tree-build-backends .

Validation:

  • All seven configured Nox test environments (CPython 3.8–3.13 and PyPy 3.11) produced 41 passed, 3 new symlink tests skipped for Windows permissions, and one existing WinError 1314 failure in test_path_pollution_symlinked_in_process. That failure also reproduces on the unchanged base.
  • A paired native Windows junction probe accepted/loaded the outside backend on base and rejected it with the change; inside targets and a linked source root remain accepted.
  • Unchanged Nox lint passed on Python 3.10, including mypy and all pre-commit hooks. Sphinx docs with -W passed.
  • Independent final review and git diff --check passed. Linux/macOS tests were not run locally.

@blouirts123
blouirts123 marked this pull request as draft October 16, 2026 04:52
@blouirts123
blouirts123 marked this pull request as ready for review October 16, 2026 05:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant