Skip to content

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented May 19, 2025

Summary

This PR uses the wonderful zizmor tool to audit our own workflows and pinact for pinned versioning 👾

Reviewers

A similar audit can be performed with the zizmor tool:

$ zizmor .
...
No findings to report. Good job! (1 ignored, 7 suppressed)

The suppressed findings are expected permission blocks at the top-level of a workflow, but we set this for each job.

Notes

Most changes I hope are repetitive, but I will comment on the more significant ones!

Requirements

@zimeg zimeg added this to the Next Release milestone May 19, 2025
@zimeg zimeg self-assigned this May 19, 2025
@zimeg zimeg requested a review from a team as a code owner May 19, 2025 23:43
@zimeg zimeg added code health M-T: Test improvements and anything that improves code health security Use on pull requests related to security semver:patch Use on pull requests to describe the release version increment labels May 19, 2025
@codecov
Copy link

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.32%. Comparing base (7235111) to head (8a2d7af).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #100   +/-   ##
=======================================
  Coverage   63.32%   63.32%           
=======================================
  Files         211      211           
  Lines       22282    22282           
=======================================
  Hits        14110    14110           
  Misses       7085     7085           
  Partials     1087     1087           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

💌 Notes on reasons that certain lines were changed for the most curious and kind reviewers!

# See https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
on:
pull_request_target:
pull_request_target: # zizmor: ignore[dangerous-triggers]
Copy link
Member Author

Choose a reason for hiding this comment

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

Heh the comments above explain the reason we use pull_request_target here but this comment makes a hopeful assumption that zizmor can be added to pipelines for future audits 🤖 ✨

Comment on lines -18 to -23
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# Default: 1
# TODO - We should not fetch all history.
# But we need to fetch the latest tag to run `make test` and `make build`.
# This is a workaround until we fetch the latest tag using the Makefile.
fetch-depth: 0
Copy link
Member Author

Choose a reason for hiding this comment

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

🪓 In this file we do not need to checkout all things!

Comment on lines -23 to -27
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# Default: 1
# TODO - We should not fetch all history.
# But we need to fetch the latest tag to run `make test` and `make build`.
# This is a workaround until we fetch the latest tag using the Makefile.
Copy link
Member Author

Choose a reason for hiding this comment

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

🪓 In this file we do need to fetch tags from past commits. This might be a lot of commits, and this TODO can be deceiving...

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

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

✅ LGTM! Thanks for helping to boost our security.

❓ I left one question around dependabot and how we want to handle its PRs going forward, but it's non-blocking to merging this one!

- name: Gather credentials
id: credentials
uses: actions/[email protected]
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
Copy link
Member

Choose a reason for hiding this comment

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

note: Whoa, this is intense! I understand from a security point-of-view (pinning to a dash instead of a tag). Thanks for adding the comment!

question: How will dependabot handle this going forward? Will it try to use a tag?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mwbrooks I had the exact same questions! It's nice that we can keep this comment inline for somewhat reasonable understandings - I cannot remember hashes so well... 🔍

How will dependabot handle this going forward? Will it try to use a tag?

AFAICT tags from official releases will be used in these updates and the comment that follows will match. This should match the current updating events, but instead with commit details!

An example update has shown this to be alright and this blog post shared a few more detail 🎃

Comment on lines +46 to +48
rsync -av --delete ./docs/ "./docs_repo/content/$REPO/"
env:
REPO: ${{ github.event.repository.name }}
Copy link
Member

Choose a reason for hiding this comment

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

praise: Clean! ✨

Copy link
Member Author

Choose a reason for hiding this comment

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

📝 Quick note, I find this surprisingly more portable too!

I don't believe the handlebar notation is supported in bash, but I do know environment variables are 😉

@zimeg
Copy link
Member Author

zimeg commented May 20, 2025

@mwbrooks Thanks for the quick and curious review! 🔏 ✨

Explorations with tags in this project has now made me warried of using these as immutable values... But we can guard against that with this change! I will merge this now.

@zimeg zimeg merged commit 918900f into main May 20, 2025
6 checks passed
@zimeg zimeg deleted the ci-audit branch May 20, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health M-T: Test improvements and anything that improves code health security Use on pull requests related to security semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants