fix: prevent module shadowing in docs formatter (use Ruff binary) #151
+60
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary: Replace python -m ruff with a direct Ruff binary invocation to avoid local module shadowing (ruff.py/ruff/). Prefer venv Scripts/bin, exclude CWD from PATH, reject .py targets, and sanitize PYTHONPATH.
Impact: Prevents arbitrary code execution on maintainer/CI when running docs formatting.
Repro (pre-fix): Place ruff.py at repo root; run format:docs; malicious file runs and writes PWNED.txt.
Result (post-fix): Malicious ruff.py does not execute; no PWNED.txt; docs format proceeds normally.
Validation: Ruff format/check passed; mypy/pyright passed; manual exploit test on Windows succeeded.
Risk: Low; same Ruff behavior/args with safer invocation and clearer failure if Ruff is missing.
Optional follow-ups
CI scan: I checked .github/workflows for “ruff”/“-m ruff”; none found. If you want, I can re-check and prepare a follow-up if needed.
Tell me your fork URL and I can push the branch for you, or I ca