Skip to content

Apply CI security best practices#687

Merged
Xuanwo merged 4 commits intoapache:mainfrom
woodruffw-forks:ww/ci-fixes
Feb 26, 2026
Merged

Apply CI security best practices#687
Xuanwo merged 4 commits intoapache:mainfrom
woodruffw-forks:ww/ci-fixes

Conversation

@woodruffw
Copy link
Contributor

Hi there! uv is a downstream user of this crate, and as a result we have an interest in ensuring your CI/CD is as secure, hermetic, and reproducible as possible 🙂

To that end, this PR has a series of commits (each of which can be reviewed separately) that will hopefully improve your default posture. These changes were made based on findings from zizmor.

To summarize:

  1. All actions references are now hash-pinned, to prevent unexpected tag mutation. Dependabot will handle updating these hash-pins for you.
  2. Dependabot itself now enforces a seven-day cooldown, to reduce the risk of quickly adopting a compromised dependency.
  3. I've minimized all permissions and credential persistence risks in all workflows. This should be reviewed carefully, since it's hard to predict ahead-of-time whether some permissions were being used implicitly.
  4. I've eliminated all flagged template injection risks. Most of these are not exploitable in practice, but intermediating expressions with shell variables ${FOO} instead of ${{ foo }} is a best practice anyways.

After all of that, the only remaining default finding is this:

info[use-trusted-publishing]: prefer trusted publishing for authentication
  --> ./.github/workflows/release.yml:40:14
   |
40 |       - run: cargo publish --workspace
   |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^ this command
   |         |
   |         this step
   |
   = note: audit confidence → High

To fix that one, one of the maintainers will need to set up Trusted Publishing and remove your current manual crates.io token. I strongly recommend doing this as a way to reduce your credential exposure risk 🙂

Finally, I've done all this without adding a workflow that will proactively catch new CI/CD issues. However, if you're interested in that, I'd be happy to add one.

Signed-off-by: William Woodruff william@astral.sh

Signed-off-by: William Woodruff <william@astral.sh>
Signed-off-by: William Woodruff <william@astral.sh>
This has two parts:

- Workflow-level permissions should always be empty,
  with jobs having explicit minimal permissions if needed.

- actions/checkout should never persist credentials to disk.

Signed-off-by: William Woodruff <william@astral.sh>
Actions expressions should always be intermediated
through shell-aware variables.

Signed-off-by: William Woodruff <william@astral.sh>
@woodruffw
Copy link
Contributor Author

Gentle ping for review!

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thank you for working on this!

@Xuanwo Xuanwo merged commit 1d5ac3d into apache:main Feb 26, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants