Repository navigation
Description
Warning
This issue is not yet ready for a PR. If you are interested in contributing to scikit-learn, please have a look at our contributing guidelines, and in particular the sections for new contributors and the "Needs triage" label.
Because of the ongoing Mini Shai Hulud attack against CI & OSS supply chain (see Postmortem: TanStack npm supply-chain compromise for details), I think we should review and possibly straighten our CI before releasing 1.9.
In particular, we use the unsafe pull_request_target in several workflows which is a documented attack vector of the Mini Shai-Hulud worm that currently still spreads by corrupting an increasing number of npm and pypi packages.
Short term:
- Regularly check that the dates of https://pypi.org/project/scikit-learn/#files match our manually triggered release dates (this seems to be the case as of today 2026-05-13)
- Review our
publish_pypi.ymlandwheels.ymlworkflows to make sure it is not subject by cache poisoning attacks (from a cursory glance it does not think we use any build cache, but we should double-check). - Review findings reported by
zizmor .github/workflows/publish_pypi.ymlandzizmor .github/workflows/wheels.yml. - Assess if workflows that use
pull_request_targetcan have a side effect on our release process.- Note: I asked the following to Claude: https://claude.ai/share/c6aea06a-a9dc-4e55-b5f4-830254166994 (TL;DNR it isn't too worried, but we should probably spend more time reading this analysis in more details).
- Unzip and review the contents of the generated wheel files in the release branch prior to uploading to look for unexpected payload.
- EDIT: I asked Claude (same conversation as the one linked above) to do that on the latest nightly wheel and it did not find anything fishy.
Medium/Long term
- Hash-pin all github actions used in the
publish_pypi.ymlandwheels.ymlworkflows. - Use relative dependency cooldown for GitHub Actions updates via dependabot:
- Find ways to avoid the use of
pull_request_targetin our regular dev CI. - Address any remaining "findings" reported by running
zizmor .in our repo (currently191 findings (73 suppressed, 32 fixable): 4 informational, 26 low, 1 medium, 87 high, many of which are related topull_request_targetand unpinned action references). - Use relative dependency cooldowns when generating lock files as soon as implemented in mamba and conda-lock:
- Isolate the release process in a dedicated repo with a easy to audit, limited number of config files/action logs/user permissions, see:
I labeled this PR as block as I think we should at least do the short terms items prior to releasing.
We can probably create sub-issues for things we agree are good ideas.
Activity
agriyakhetarpal commentedon May 13, 2026
I believe y'all will be fine using
pull_request_targetas long as it doesn't check out any user code usingactions/checkoutand permissions for a specific job are scoped down to only what it needs.Another good thing to do here is to hash-pin all refs in pre-commit hooks; they currently aren't so: https://github.com/scikit-learn/scikit-learn/blob/ab6f86c1086377c19754177e0f46eb26e6282be5/.pre-commit-config.yaml. Zizmor may gain functionality to audit this in the future: zizmorcore/zizmor#1799, but for now, either
pre-commit autoupdate --freezeorprek autoupdate --freezewill do it.Other things to check/do:
id-token: writeattempting to build / invoke unrelated scripts zizmorcore/zizmor#1968There are also various useful recommendations to check out in this blog, in case you may have not come across it already (it goes quite a bit further about
pull_request_target, for example): https://astral.sh/blog/open-source-security-at-astral.AnneBeyer commentedon May 13, 2026
I can create a PR for hash-pinning the actions, unless you're already working on that, @ogrisel?
betatim commentedon May 13, 2026
@AnneBeyer I have a vague memory of us discussing the topic of using hash'es for GitHub actions before. However I can't find it in the issues :( My memory of it is that we discussed if we need/should pin all actions to hashes or if some can be left pinned to a specific version (e.g. those maintained by GitHub). I think the argument for not going "maximum pinning" was that it makes it more difficult to update things (potentially dependabot stops working) and that would not be great. https://github.com/scikit-learn/scikit-learn/blob/main/.github/dependabot.yml has a comment similar to this in it. Maybe something to fact check given that it is now 2 years later. (Maybe it is time to re-read SPEC8 and/or update its advice as well?)
betatim commentedon May 13, 2026
Agriya mentioned that we should also look at pre-commit pinning, which made me wonder: should we think about our other CI as well?
Now that someone mentioned it, using pre-commit makes me super nervous :D We are basically forcing software on every contributor and updating it for them. At least I don't know if/when/how pre-commit updates things and how I could stop it from doing that/ask for my permission.
AnneBeyer commentedon May 13, 2026
From the last dependabot update PR it looks like it is able to handle both types, but the dependabot repo does have a few open issues on the consistency of hash and version comment in some updates.
ogrisel commentedon May 13, 2026
From what I recall, I think we stated we wanted to use SHA pinning on sensitive workflows such as
publish_pypi.yml. We might want to do the same forwheels.ymland also configure a 7D cooldown.ogrisel commentedon May 13, 2026
The version comment bug is annoying but not critical.
ogrisel commentedon May 15, 2026
I removed the block label based on the feedback of @agriyakhetarpal and the analysis of claude I linked above.
However, I think it would be worth asking Claude or similar to check that the generated release wheels (e.g. those we push to test.pypi.org) have not been tainted with malware the way I did for nightly wheels.
AnneBeyer commentedon May 19, 2026
Should we merge #33917 first to avoid conflicts?
ogrisel commentedon May 19, 2026
Let's do that. Thanks for the review @AnneBeyer, I applied your suggestions and enabled auto-merge.
ogrisel commentedon May 21, 2026
OSS Supply Chain attacks do not only target CI: they can also target dev tools such as VS Code extensions to propagate by stealing github, pypi or other services credentials from OSS developers: https://www.bleepingcomputer.com/news/security/github-confirms-breach-of-3-800-repos-via-malicious-vscode-extension/
Isolating the scikit-learn release repo with limited users with permissions on that repo would also help reduce our attack surface and better our project against this way of spreading malware into our release artifacts.
ogrisel commentedon Jun 16, 2026
Note that @thomasjpfan create the scikit-learn-release repo here: https://github.com/scikit-learn/scikit-learn-release during last week's sprint.
@thomasjpfan could you please let us know if you found any blockers in the process and maybe open a dedicated issue to cross-reference with a TODO list before being able to update our release process to use this new infrastructure?
ogrisel commentedon Jun 16, 2026
Related PR by @lesteve to simplify the release workflow and make it more maintainable: #34215
EDIT: the workflow file of https://github.com/scikit-learn/scikit-learn-release already uses the cibuildwheel v4 github action.
ogrisel commentedon Jun 16, 2026
Also, another related PR to tackle the possibility to implement a relative dependency cooldown policy when refreshing our lockfiles. As documented above, mamba/conda-lock do not yet support them but pixi does. The following PR considers migrating our conda-lock based setup to pixi:
#34212
EDIT: I wrote more details about implementing the use of lockfiles and relative dependency cooldowns specifically for the isolated release repo in scikit-learn/scikit-learn-release#1.
thomasjpfan commentedon Jun 17, 2026
I opened #34320 that lists out what is left to do and what the release process could look like.
betatim commentedon Sep 23, 2026
I just saw https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target#default-policy-for-pull_request_target TLDR: from 2 November GitHub will restrict (aka block) workflows that use the
pull_request_targettrigger. If we want to keep using it we need to setup our own policy,I think the workflows we have right now need to use
pull_request_targetand we are fairly sure that we are "doing it right" (famous last words). So I'd add a policy to allow them.Thoughts anyone? @lesteve ?
https://github.blog/changelog/2026-09-10-control-github-actions-cache-access-with-cache-mode/ looks interesting because it allows us to control access to the cache. This is useful because using one workflow to poison the cache of a different workflow is a "popular" way to exploit workflows. I haven't looked at this carefully enough to know what we can/should do.
lesteve commentedon Oct 4, 2026
Sorry I missed this but yeah I think we are fine for now with the "famous last words" caveat as you say 😅.
The killer combination is
pull_request_target+ explicit checkout of PR branch code (checkout withpull_request_targetchecks outmainby default), in other words the warnings in https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target#reviewing-the-impact-before-enforcementThe Astral security blog post says that they completely disallow
pull_request_target:They recommend using GitHub App in the use cases you would use
pull_request_target:I haven't had a closer look how complex it would be and whether it would be worth it. In the past, I guess you would do this with a Heroku thingy (I have recently seen Cloudflare Python workers mentioned recently as a potential Heroku replacement)
lesteve commentedon Oct 8, 2026
I read your message too quickly so I thought that you enabled policies @betatim but unfortunately not, I opened #35103 so that we can remember to do it. And of course if you want to do it, it would be more than welcome 😉.
lesteve commentedon Nov 3, 2026
I removed the 1.10 milestone because I don't think there is anything that absolutely needs to be done for the upcoming 1.10 release. Let me know if I missed something!