Skip to content

Set up Zizmor#70

Merged
mwolting merged 1 commit into
mainfrom
matthijs/zizmor
May 12, 2026
Merged

Set up Zizmor#70
mwolting merged 1 commit into
mainfrom
matthijs/zizmor

Conversation

@mwolting
Copy link
Copy Markdown
Contributor

@mwolting mwolting commented May 12, 2026

Towards LIN-70000

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 12, 2026

LIN-70000

Comment on lines +53 to +60
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
MERGE_COMMIT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: |
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
gh api --method POST "repos/${GITHUB_REPOSITORY}/git/refs" \
-f ref="refs/tags/v${VERSION}" \
-f sha="${MERGE_COMMIT_SHA}"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this a change we need to make to keep zizmor happy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is for Zizmor’s template-injection audit. GitHub expands ${{ ... }} inside run: before the shell sees the script, so attacker-controlled values like PR branch names can break out of quoting and inject shell. Passing them through env and then using quoted shell variables like "${VERSION}" is the mitigation Zizmor expects.

Some of these are lower-risk because they’re validated/derived values, but keeping GitHub expressions out of shell run: blocks is the consistent pattern and avoids the Zizmor findings coming back.

which feels legit conceptually even if low practical risk for the specific setup here

Copy link
Copy Markdown
Contributor Author

@mwolting mwolting May 12, 2026

Choose a reason for hiding this comment

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

Ah and the tagging change itself:

Zizmor wants actions/checkout to use persist-credentials: false; once we do that, git push origin ... no longer has checkout-provided credentials.

We could reintroduce credentials for Git manually, but using gh api keeps the token scoped to the specific command via GH_TOKEN and avoids writing credentials into the checkout/remote config. Functionally it’s equivalent here: the old git tag && git push created a lightweight tag ref, and the API call creates/moves that same Git ref directly.

So the gh change isn’t because Zizmor dislikes git tag; it’s the cleaner way to preserve the behavior after disabling persisted checkout credentials.

@mwolting mwolting merged commit 138a85b into main May 12, 2026
10 checks passed
@mwolting mwolting deleted the matthijs/zizmor branch May 12, 2026 08:09
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.

3 participants