Skip to content

fix(frontend): validate in-tree backend paths - #320

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
blouirts123:fix/validate-in-tree-backend-paths
Oct 16, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
blouirts123:fix/validate-in-tree-backend-paths

Conversation

@blouirts123

Copy link
Copy Markdown
Contributor

create_args_from_folder() currently accepts backend paths outside the project, such as ../outside, and passes them through to the backend subprocess. Validate the in-tree backend path constraint while reading configuration: reject absolute entries, embedded NUL, resolution errors and resolved targets outside the root. Valid entries retain their existing path values.

Adds regressions and documents the contextual ValueError. This is configuration/spec-conformance validation for build input; build backends already execute project-supplied code.

Validation: root and independent focused runs: 14 passed; full suite: 87 passed and one existing Windows symlink-privilege failure (WinError 1314). Pre-commit, type checks and Sphinx warnings-as-errors pass. A local coverage run with the privilege-blocked test deselected reached 97.37%, so the full 100% gate is not claimed locally. A manual Windows junction case was also rejected as expected.

blouirts123 and others added 2 commits October 16, 2026 06:18
Move the backend-path validation into a helper so the config reader keeps
its one-line tuple build. Resolve the project root inside the try, so a
resolution failure there also surfaces as the documented ValueError, and
drop ValueError from the caught types: the explicit NUL check covers it.
Python 3.15 on Windows resolves a NUL-containing path without raising, so
that check has to stay.

Tests: table-drive the rejected entries with pytest.param ids, add a
symlink pointing outside the project, and patch Path.resolve with an
autospec mock instead of a hand-written replacement.
@gaborbernat gaborbernat changed the title Validate in-tree backend paths when reading project configuration fix(frontend): validate in-tree backend paths Oct 16, 2026

@gaborbernat gaborbernat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat
gaborbernat enabled auto-merge (squash) October 16, 2026 01:20
@gaborbernat
gaborbernat merged commit 55cfc9f into tox-dev:main Oct 16, 2026
26 checks passed
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.

2 participants