Skip to content

ci: Resolve most zizmor findings as of zizmor@1.31.1 - #3045

Merged
Kobzol merged 8 commits into
rust-lang:mainfrom
hashcatHitman:ref-version-mismatch_and_stale-action-refs_and_unpinned-uses
Oct 26, 2026
Merged

Kobzol merged 8 commits into
rust-lang:mainfrom
hashcatHitman:ref-version-mismatch_and_stale-action-refs_and_unpinned-uses

Conversation

@hashcatHitman

@hashcatHitman hashcatHitman commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

In pursuit of getting more zizmor lints enforced across rust-lang repos through crabwatch, this PR fixes most zizmor findings as of zizmor@1.31.1, using the auditor persona. The lints that actually fired per-persona level are:

regular persona findings:

pedantic persona findings:

auditor persona findings:

  • Everything from pedantic
  • Not fixed in this PR:
    • None

The hash pin format is supported by tools like Dependabot and Renovate, which can update the pinned hashes and their associated comments. If you'd like help setting either of those up, let me know which you prefer, and if you'd like it in this PR or a new one. By default, I would assume to set them up to only update GitHub Actions.

@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Oct 7, 2026
See: https://github.com/actions/cache/releases/tag/v4.3.0

This is the same version we were already using at the time of writing.

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
See: https://github.com/actions/checkout/releases/tag/v7.0.1

This is the same version we were already using at the time of writing.

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
See: https://github.com/actions/github-script/releases/tag/v7.1.0

This is the same version we were already using at the time of writing.

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
@hashcatHitman
hashcatHitman marked this pull request as draft October 22, 2026 15:17
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Oct 22, 2026
@hashcatHitman
hashcatHitman force-pushed the ref-version-mismatch_and_stale-action-refs_and_unpinned-uses branch from 621e147 to f42d3ed Compare October 22, 2026 15:22
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
@hashcatHitman
hashcatHitman force-pushed the ref-version-mismatch_and_stale-action-refs_and_unpinned-uses branch from f42d3ed to a688144 Compare October 22, 2026 17:34
@hashcatHitman
hashcatHitman deleted the ref-version-mismatch_and_stale-action-refs_and_unpinned-uses branch October 22, 2026 17:36
@hashcatHitman hashcatHitman reopened this Oct 22, 2026
@hashcatHitman

Copy link
Copy Markdown
Member Author

Oops. Guess I can't rename branches when I have a PR open. Noted. Pretend I renamed the branch for this PR to zizmor.

@hashcatHitman hashcatHitman changed the title ci: Resolve ref-version-mismatch, stale-action-refs, and unpinned-uses ci: Resolve most zizmor findings as of zizmor@1.31.1 Oct 22, 2026
@hashcatHitman
hashcatHitman restored the ref-version-mismatch_and_stale-action-refs_and_unpinned-uses branch October 22, 2026 17:38
@hashcatHitman
hashcatHitman marked this pull request as ready for review October 22, 2026 17:46
@rustbot

rustbot commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Oct 22, 2026
@hashcatHitman

Copy link
Copy Markdown
Member Author

r? rustc-dev-guide

@Kobzol Kobzol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Left two comments.

View changes since this review

Comment thread .github/workflows/ci.yml
git config user.email ""
git add .
git commit -m "Deploy ${GITHUB_SHA} to gh-pages"
git push --quiet -f "https://x-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}" HEAD:gh-pages

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this change? Is GITHUB_TOKEN even passed as an environment variable by default?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Why this change?

template-injection lint. Even when not necessarily dangerous, zizmor considers template expansions a code smell.

Is GITHUB_TOKEN even passed as an environment variable by default?

I don't think so, but in this case, it was already explicitly put into the environment:

jobs:
ci:
if: github.repository == 'rust-lang/rustc-dev-guide'
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.5.2
MDBOOK_LINKCHECK2_VERSION: 0.13.0
MDBOOK_MERMAID_VERSION: 0.17.0
MDBOOK_OUTPUT__LINKCHECK__FOLLOW_WEB_LINKS: ${{ github.event_name != 'pull_request' }}
DEPLOY_DIR: book/html
BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see. It seems safer to not put it into the environment and only access it through secrets, but I don't know if there is anything else here that might be reading it.

FWIW, I don't like this lint being applied to things that are clearly safe from expansion attacks, such as secrets.GITHUB_TOKEN.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't know if there is anything else here that might be reading it.

Yeah, that's the tricky part. There's only so much I can do to test these things on my own (I already accidentally used up all my free minutes for this month doing so, it seems... oops!), so I have to try to err on the side of "not breaking infrastructure".

It seems safer to not put it into the environment and only access it through secrets

I think it isn't really meaningfully safer, though I would definitely prefer the scope be reduced (env for a specific step, rather than the entire job). That suffers the same "I don't know what might be using this already" problem, though.

Ideally, the token only grants read permissions/none at all and is not really a concern regardless for public repos. Which I think is the relationship permissions: {} creates? It's a little unclear how that works.

Comment thread .github/workflows/date-check.yml

@Kobzol Kobzol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Kobzol
Kobzol merged commit 69e3b70 into rust-lang:main Oct 26, 2026
8 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Oct 26, 2026
@hashcatHitman
hashcatHitman deleted the ref-version-mismatch_and_stale-action-refs_and_unpinned-uses branch October 26, 2026 17:39
@hashcatHitman hashcatHitman moved this to Policy Adjusted in t-crabwatch policy expansion Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Policy Adjusted

Development

Successfully merging this pull request may close these issues.

4 participants