Add zizmor to pre-commit - #650
Conversation
|
Meh, seems a little blunt. Given that the only dangerous permission those SSH keys have is write access to this repository, surely it's more meaningful just to turn that permission off in settings? Beyond that, I can only see |
|
Write access to the repo means you can deploy to PyPI, because we're using Trusted Publishing without a dedicated "environment" for manual approvals: https://docs.pypi.org/trusted-publishers/security-model/ Perhaps we should add an environment? My thinking about fixing these was that when the tool is ready to be used in pre-commit, we can add it there, because it would have helped against some of the problems that led to the ongoing Ultralytics vulnerability (note this was written by the author of zizmor): https://blog.yossarian.net/2024/12/06/zizmor-ultralytics-injection And after I opened this, zizmor is now ready for pre-commit (https://github.com/woodruffw/zizmor-pre-commit), so I've added it to this PR.
Yeah, can do. As those settings are only visible to admins, I think it's also good to have safe values in the code as well.
We could revert these workflow changes, and ignore that rule in the config? https://woodruffw.github.io/zizmor/configuration/#rulesidignore Or we can also just close this PR if you prefer? |
Yeah, that would appease my nose wrinkling.
Hmm, maybe. I don't know what that would block. Would Renovate still be able to verify PRs for example. TBH, the more I read about trusted publishing, the more I feel that we should just go back to downloading the wheels as artifacts then uploading them locally via twine. Not being able to tell when a workflow can invisibly use |
FWIW: the absence of a secret in a workflow definition doesn't mean it's not present in that workflow's runner's environment. GitHub's runner agent doesn't distinguish between "used" and "unused" secrets when loading them into a runner: they all get loaded, and any code on that runner can dump them all from memory. That's why the Ultralytics attacker was able to pivot and steal a PyPI API token, despite not compromising a workflow that had one listed. The thing that keeps pull requests from getting access to TL;DR: every workflow that runs in your upstream repo context has access to your secrets, whether you explicitly include them or not. That's why Trusted Publishing isn't based on secrets, and it's also why the docs encourage people to configure an (actions, not process) environment for the Trusted Publishing workflow 🙂 |
|
(And to answer the question: adding an environment wouldn't block anything, except whichever workflow you want it to. If your Renovate job isn't in the same workflow as your release job, the two won't interact.) |
|
Updated to ignore this rule. |
|
I've reviewed the tokens we have at https://github.com/ultrajson/ultrajson/settings/secrets/actions
(Here's an idea, leave fake credentials in the GH settings to waste the time of attackers! 🙃) |
https://github.com/woodruffw/zizmor is a static analysis tool for GitHub Actions and can find potential security issues.
The one found here are all straightforward: