Forced pip update raises supply chain safety concerns (and is often useless)
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- github-actions, python, typescript
Direção de pesquisa
Nenhum arquivo de origem, teste ou ponto de entrada é nomeado. Comece rastreando o caminho de atualização automática do pip no setup-python e como a entrada pip-version é tratada; considera-se concluído quando os chamadores podem optar por não participar, uma atualização incondicional para a versão mais recente é evitada e o cooldown proposto é aplicado com segurança.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description:
As of v6.3.0, setup-python appears to unconditionally auto-update pip, without a dependency cooldown.
Even when a pip-version input is specified, setup-python seemingly updates pip to the latest version first, then installs the specified version.
This behavior raises supply chain safety concerns: If pip itself were subject to a supply chain attack,[^1] any callers of setup-python would be immediately affected during the attack window of opportunity.
Also, updating pip on user level seems pointless when virtual environments are used (which you should), because (AFAIK) venvs are initialized with python's bootstrap copy of pip, not site-packages pip.
However, note that merely not calling setup-python's updated pip does not resolve these concerns, because an attacker might upload only an sdist of pip, which would allow for install-time execution of the hypothetical attack.
To be clear, we all hope that this scenario stays entirely hypothetical, but the point is that setup-python is not following safety best practices here, rsp. does not even allow the caller to do so.
Proposed remediation:
- Add an option to let the caller opt out of pip auto-updating entirely (given that it is pointless when a venv is used).
- Subject the default behavior of auto-updating pip to a dependency cooldown, ideally configurable through an input.
Suggested default: 3 days, like dependabot, or anything non-zero really. - When a
pip-versionis specified, install the given version right away without first updating to latest.
Note that updating pip itself with a cooldown is complicated by the fact that pip versions before 26 do not support --uploaded-prior-to, PIP_UPLOADED_PRIOR_TO etc.
This can basically be worked around by updating to a pinned and hash-checked version first, then updating with cooldown.
The following script shows how to do this: https://github.com/pypdfium2-team/pypdfium2/blob/811faae77f8fc90bc57832bc6400c65fd9f4fbee/utils/update_pip.py
Justification:
Supply chain safety, see the description above.
Are you willing able to submit a PR?
No, I am not a typescript programmer and not familiar with setup-python's internals.
Edit: Submitted https://github.com/actions/python-versions/pull/406 after all, a simple patch to avoid possible setup-time code execution when updating pip. This should stuff a key loophole and allow an aware caller to be unaffected, but otherwise the issue still stands.
[^1]: Hypothetical and hopefully highly unlikely, but no project is per se immune to it, and you have to acknowledge that pip would be a very lucrative target for a supply chain attack, so downstream precautions seem important.
- Linguagem predominante
- TypeScript
- Estrelas
- 2.2k
- Forks
- 739
- Merge médio
- 6d 18h
- PRs com merge (30d)
- 1
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de actions/setup-python
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
actions/setup-python#1348 · 5 comentários ·
-
feature request
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 58/100
actions/setup-python#1308 · 8 comentários ·
-
feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
actions/setup-python#1301 · 5 comentários ·
-
feature request
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
actions/setup-python#1294 · 3 comentários · 2 reações ·
-
feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 20/100
actions/setup-python#1243 · 2 comentários ·
Todas as issues de actions/setup-python
Issues semelhantes
-
blocklist removal
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
pastelsky/bundlephobia#1122 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100