Title: chore: Harden workflows: least-privilege permissions + zizmor integration by brunoborges · Pull Request #1039 · actions/setup-java · GitHub
Open Graph Title: chore: Harden workflows: least-privilege permissions + zizmor integration by brunoborges · Pull Request #1039 · actions/setup-java
X Title: chore: Harden workflows: least-privilege permissions + zizmor integration by brunoborges · Pull Request #1039 · actions/setup-java
Description: Summary Hardens the action's own CI/CD workflows by applying GitHub Actions security best practices and integrates zizmor so regressions are caught automatically going forward. Motivation: after the recent supply-chain compromises in the Actions ecosystem, consumers increasingly expect the actions they depend on to follow least-privilege and hardening practices. These changes are config-only — no action source (src//dist/) is touched, so runtime behavior of setup-java is unchanged. What changed 1. Least-privilege permissions: on every workflow Previously most workflows had no permissions: block and therefore inherited the repository/organization default token scopes. Now each workflow declares exactly what it needs: Workflow Permissions basic-validation, check-dist, licensed, all e2e-* contents: read codeql-analysis top-level {}, job keeps actions: read / contents: read / security-events: write publish-immutable-actions top-level {}, job keeps contents: read / id-token: write / packages: write update-config-files top-level {}, job gets contents: write + pull-requests: write (needed to push the branch and open the PR) release-new-action-version already scoped to contents: write (unchanged) 2. Drop credential persistence Added persist-credentials: false to all actions/checkout steps that don't subsequently use the GITHUB_TOKEN (every e2e/validation checkout plus the immutable-publish checkout). This prevents the token from lingering in the local git config. 3. Avoid template injection in run: blocks Moved ${{ matrix.version }} and ${{ steps.setup-java.outputs.path }} expansions out of inline run: scripts into env: variables referenced as "$VAR", the pattern recommended to avoid shell injection via expression interpolation. 4. Pin the container image alpine:latest → alpine:3.21 in e2e-versions.yml (mutable latest tag → fixed version). 5. Integrate zizmor .github/workflows/zizmor.yml — runs on push/PR, fails the build on any finding (regression gate), and uploads SARIF to the Code scanning tab. .github/zizmor.yml — pinning policy aligned with this repo's conventions: first-party actions/* and github/* may use version tags (ref-pin), while any third-party action must be pinned to a full commit SHA (hash-pin). Validation zizmor goes from 39 high + 39 medium + 31 low/info findings to 0, both offline and online: $ zizmor .github/workflows/ No findings to report. Good job! All workflow YAML was validated for syntax. Related Addresses the hardening/security-posture aspect mentioned alongside #1023 (immutable releases). The publish-immutable-actions.yml workflow that satisfies #1023 is also hardened here (persist-credentials: false, explicit top-level {}).
Open Graph Description: Summary Hardens the action's own CI/CD workflows by applying GitHub Actions security best practices and integrates zizmor so regressions are caught automatically going forward. Motivation: afte...
X Description: Summary Hardens the action's own CI/CD workflows by applying GitHub Actions security best practices and integrates zizmor so regressions are caught automatically going forward. Motivation: ...
Opengraph URL: https://github.com/actions/setup-java/pull/1039
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:45d80835-9dc0-dc37-b397-1eec6c4c0686 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 967E:377E20:1655D:1C902:6A4C68AA |
| html-safe-nonce | 27448a202c4a634a4e3ccf9da5f3be631a33474a64ad9131938652d9634e1a76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjdFOjM3N0UyMDoxNjU1RDoxQzkwMjo2QTRDNjhBQSIsInZpc2l0b3JfaWQiOiIxNDExNTU3MDgzOTcxMzQ4NjUwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bde7e6bb78f8f8524ab7155dd22b6e1c64de634b141c8184d71ff70f71ee83a6 |
| hovercard-subject-tag | pull_request:3914606617 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,actions,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/actions/setup-java/pull/1039/files |
| twitter:image | https://avatars.githubusercontent.com/u/129743?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/129743?s=400&v=4 |
| og:image:alt | Summary Hardens the action's own CI/CD workflows by applying GitHub Actions security best practices and integrates zizmor so regressions are caught automatically going forward. Motivation: afte... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/actions/setup-java git https://github.com/actions/setup-java.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 196057608 |
| octolytics-dimension-repository_nwo | actions/setup-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 196057608 |
| octolytics-dimension-repository_network_root_nwo | actions/setup-java |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width