Skip to content

Do not use pip-install; add dependency cooldowns - #5146

Merged
cobaltt7 merged 6 commits into
psf:mainfrom
JelleZijlstra:codex/zizmor-low-severity
Aug 4, 2026
Merged

Do not use pip-install; add dependency cooldowns#5146
cobaltt7 merged 6 commits into
psf:mainfrom
JelleZijlstra:codex/zizmor-low-severity

Conversation

@JelleZijlstra

Copy link
Copy Markdown
Collaborator

Zizmor recommends against pip-install (https://docs.zizmor.sh/audits/#misfeature).

Also add dependency cooldowns to prevent supply-chain compromises.

@JelleZijlstra JelleZijlstra added the ci: skip news Pull requests that don't need a changelog entry. label May 21, 2026
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

diff-shades results comparing this PR (35461f0) to main (18684cc):

--preview style: no changes

--stable style: no changes


What is this? | Workflow run | diff-shades documentation

@cobaltt7

Copy link
Copy Markdown
Collaborator

Zizmor recommends against pip-install because it installs dependencies to the global scope and makes them vulnerable to dependency conflicts. This change does the same thing, just without being flagged by Zizmor. The correct fix to this would be to create a venv inside the workflow and install dependencies there. IMO that's overkill and unnecessary because there's only one pip-install per job and not much opportunity for conflicts

@cobaltt7
cobaltt7 force-pushed the codex/zizmor-low-severity branch from 8a0b468 to ff03ce8 Compare July 24, 2026 21:18
@cobaltt7

Copy link
Copy Markdown
Collaborator

setup-python 7.0.0 has removed the input: actions/setup-python#1336
Note again that this change is effectively the same as using pip-install, and installs into the runner-level environment. Again, I don't think this is an issue because we don't run multiple install commands or mix multiple tools. The proper fix to this would be to use a venv in each workflow, which to me feels like overkill, and IMO GHA should always have a quick-and-dirty way to install packages. It makes most sense to me to keep this until/unless it stops working

Would it be a bad idea to set PIP_UPLOADED_PRIOR_TO=P2D as a repository env value instead? That avoids repetition in workflow files and the possibility of forgetting to include it.

@JelleZijlstra

Copy link
Copy Markdown
Collaborator Author

A repository-level fix sounds good!

JelleZijlstra and others added 2 commits August 3, 2026 16:34
Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
@cobaltt7
cobaltt7 force-pushed the codex/zizmor-low-severity branch from 3210e7b to 87a0e55 Compare August 3, 2026 22:38
Currently setup-python is uninstalling 26.2 and reinstalling 26.1, adding more time to every workflow and an extra line to every workflow file
I kept it in places where we use matrix python versions.

Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
@cobaltt7

cobaltt7 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

virtualenv 20.39.1 (via hatch) uses pip 26.0: https://github.com/pypa/virtualenv/blob/20.39.1/src/virtualenv/seed/wheels/embed/__init__.py#L39

virtualenv 21.3.0 bumps pip to 26.1: https://github.com/pypa/virtualenv/blob/21.3.0/src/virtualenv/seed/wheels/embed/__init__.py#L42

Working around this by manually calculating PIP_UPLOADED_PRIOR_TO until we can bump virtualenv #5023 (blocked by #5037, which is blocked by pypa/hatch#2257)

Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
And add it to more workflows and the Dockerfile

Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
@cobaltt7

cobaltt7 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

It's better to set PIP_UPLOADED_PRIOR_TO inline after all, because otherwise it won't be included in workflows triggered by forks. I also added it to the Dockerfile.

@cobaltt7
cobaltt7 merged commit a61e98a into psf:main Aug 4, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: skip news Pull requests that don't need a changelog entry.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants