Visitar URL original
🐛 fix(seed): copy from temporary app-data by gaborbernat · Pull Request #3437 · pypa/virtualenv · GitHub
Skip to content

🐛 fix(seed): copy from temporary app-data - #3437

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
gaborbernat:fix/transient-app-data-seeding
Oct 17, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
gaborbernat:fix/transient-app-data-seeding

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

The command-line --symlink-app-data switch is disabled when app-data is temporary, but VIRTUALENV_SYMLINK_APP_DATA and virtualenv.ini can still supply a true default. The seeder then links pip into a temporary cache that virtualenv deletes after creation, leaving a dangling package path. On a shared temporary directory, another account can claim that path before the environment owner next runs pip. 🐛 This PR copies seed packages whenever the selected app-data store is temporary. It addresses GHSA-4f8h-vr72-p32c.

The command-line guard did not cover configuration defaults

add_parser_arguments changes the switch to store_false when app-data is temporary. That guards an explicit command-line flag, but configuration and environment values can become the parser default. FromAppData.__init__ used that value without checking the selected cache lifetime. The seeder now checks app_data.transient when choosing between copying and linking, so all three option sources follow the same rule. The regression tests create an environment with an unusable persistent cache and check that pip remains available after the temporary cache is removed.

Behavior changes

When app-data is temporary, a symlink request from an environment variable or configuration file now copies seed packages and logs the fallback at debug level. Persistent app-data keeps the requested symlink behavior. Recreate environments that already contain dangling seed links.

Reported by Anthropic's OSS Scanner: ANT-2026-ZOE2GEPC.

Configuration and environment defaults can enable symlink seeding with
temporary app-data. The links dangle when virtualenv removes that cache.
Choose copying when the selected app-data store is temporary.
Windows Python 3.9 and 3.10 fail to start interpreter subprocesses when these tests replace the entire environment. Keep host variables while overriding the settings needed for temporary app-data.
@gaborbernat
gaborbernat merged commit b81995c into pypa:main Oct 17, 2026
76 checks passed
@bboretzky

Copy link
Copy Markdown

Thank you for the fix. A request on the advisory record: GHSA-4f8h-vr72-p32c (CVE-2026-113713) lists the affected range as >= 21.14.8 with no patched version, while this change shipped in 21.14.10 (its changelog entry). Could the advisory record 21.14.10 as the patched version?

As it stands, once the advisory is reviewed into the global advisory database, OSV and pip-audit will flag every release from 21.14.8 on, 21.14.10 and later included, with no fixed version to move to. Downstream we are setting a >=21.14.10 floor on the strength of the changelog.

@gaborbernat
gaborbernat deleted the fix/transient-app-data-seeding branch October 22, 2026 14:49
@gaborbernat

Copy link
Copy Markdown
Contributor Author

hanks for flagging it. GHSA-4f8h-vr72-p32c now records 21.14.10 as the patched version. The affected range is >= 20.0.6, < 21.14.10: the advisory traces the incomplete temporary-cache guard to #1661, first released in 20.0.6, so the earlier lower bound of 21.14.8 understated it. Your >=21.14.10 floor matches the fix.

This was referenced Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants