Skip to content

🐛 fix(activation): reject shell PATH options - #3734

Merged
gaborbernat merged 5 commits into
pypa:mainfrom
gaborbernat:fix/3hk-dash-path-option
Nov 20, 2026
Merged

gaborbernat merged 5 commits into
pypa:mainfrom
gaborbernat:fix/3hk-dash-path-option

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Some environment paths change how dash looks up commands after activation. Regardless of the current shell, creation rejects a resolved destination when its first % starts the lowercase option %func or %builtin, including on Windows, where Git ships dash. Choose a different directory name if creation reports a shell PATH option. Other percent signs are allowed. Dash command lookup.

Bash rejects the same percent options when an environment has moved. PowerShell and Python reject them in paths they discover at activation. Bash relocation and Python activation also reject directories containing the platform's PATH separator, so the environment's executable directory stays a single PATH entry.

Reported by oss-scanner. Draft advisory ANT-2026-3HKDKHBU.

@gaborbernat gaborbernat added bug security Fixes a vulnerability or hardens the supply chain, CI or release labels Nov 20, 2026
@gaborbernat
gaborbernat force-pushed the fix/3hk-dash-path-option branch from c369c28 to d9e9605 Compare November 20, 2026 15:13
dash treats the first percent sign in a PATH entry as an option delimiter.
Paths with %func or %builtin can then load shell functions outside the
virtual environment. Reject them at creation and activation, including
after relocation. PowerShell needs an ordinal comparison to catch combining
marks after the option name.
@gaborbernat
gaborbernat force-pushed the fix/3hk-dash-path-option branch from d9e9605 to 4d4c1b1 Compare November 20, 2026 15:34
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 17:02
@gaborbernat
gaborbernat marked this pull request as draft November 20, 2026 20:27
Dash also ships with Git for Windows. Reject its PATH options on Windows
and check that relocated executable directories occupy one PATH entry in
Bash and Python activation.
Git Bash can return a drive-qualified path for a moved environment.
Check for PATH separators after converting the drive letter to its
shell spelling, so the guard sees the path that activation will use.
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 21:42
@gaborbernat
gaborbernat merged commit 8c2f31e into pypa:main Nov 20, 2026
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug security Fixes a vulnerability or hardens the supply chain, CI or release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant