Skip to content

Use pylock generation command in empty-hash warnings - #21547

Open
astral-automations-bot[bot] wants to merge 1 commit into
mainfrom
zb/pylock-empty-hash-command-hint
Open

astral-automations-bot[bot] wants to merge 1 commit into
mainfrom
zb/pylock-empty-hash-command-hint

Conversation

@astral-automations-bot

Copy link
Copy Markdown
Contributor

The empty-hash warning added in #21462 asks users to regenerate pylock.toml without showing the command recorded in uv-generated files. Read that command from the header and include it in the warning. Files without a usable header retain the general guidance, and hash tables with unsupported algorithms remain accepted without the empty-table warning.

Comment on lines +562 to +565
if let Some(command) = generating_command(content) {
warn_user_once!(
"Empty hash tables in `pylock.toml` will be rejected in a future uv version. Run `{}` to regenerate the file.",
command.green()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] Avoid trusting generation commands from remote pylock files

read_pylock_toml also passes HTTP(S) response bodies into PylockToml::parse, so content is not always a trusted local uv-generated file. This branch presents any matching header as uv's Run ... advice; generating_command rejects controls and backticks but still accepts shell syntax such as curl ... | sh. A malicious HTTP responder or remote lock publisher can therefore make uv recommend an attacker-chosen command, which executes with the user's authority if they follow the warning. Preserve source provenance and use generic guidance for remote locks instead of echoing their header as a command.

This branch was previously deployed

1 inactive deployment
automations — 5d96b628 Deployed Oct 7, 2026 by astral-automations-bot[bot] via review / security review #49979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:error-messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant