GitHub advisory · PyPI
virtualenv: Generated files can follow existing destination links
Description
Generated activation files and pyvenv.cfg can follow existing links and write outside the requested environment. The template writer tests exists() before unlinking, which misses dangling symlinks; the configuration writer opens the existing path directly.
Anthropic's OSS Scanner reported this as ANT-2026-XBEOCBS1 in virtualenv-20261015-005, received on 15 October 2026.
Final file entries written during environment creation and seeding.
Another account must be able to prepare file links in the destination before creation. The invoking user must have write permission at the linked target. The destination parent must remain controlled during creation; concurrent parent-directory replacement is a separate concern.
The relevant 21.14.8 source is in template writer, configuration writer.
ViaTemplateActivator._generate() removes an existing output only when Path.exists() is true. A dangling symlink
therefore survives, and write_bytes() creates its target outside the environment. Other generated files have related
final-entry behavior. PyEnvCfg.write() opens pyvenv.cfg without first replacing an existing link; a symlink or hard
link there can overwrite an existing target. These paths require a prepared destination tree and the invoking user's
permission to write the linked target.
The scanner's project tree contains venv/bin/activate -> ../../../.bash_aliases and an executable venv/bin/basename.
Before creation, a new interactive bash does not create the marker. A plain virtualenv venv writes the activation
script through the dangling link, creating ~/.bash_aliases as a regular file.…
Manual fix · PyPI
pip install --upgrade "virtualenv>=21.14.9"Sources