Repository navigation
GHA: tighten secret + permission scoping - #3359
Conversation
- sonatype.yaml: deploy secrets moved from job-level env to the Deploy
step's env so they're not in scope for any future step added before
the deploy.
- codeql-analysis.yml: add workflow-level `permissions: {}` so the
job's elevated grants (security-events: write etc.) are explicit
additive overrides instead of trimming from the broad default.
- macos.yaml, windows.yaml: drop unused `GITHUB_TOKEN` env from test
steps. Other workflows' test steps don't pass it and the tests don't
reference it.
📝 WalkthroughWalkthroughThis PR hardens CI workflows by applying least-privilege access controls across four GitHub Actions workflow files. CodeQL adds default-deny permissions, Sonatype scopes secrets to specific deployment steps, and macOS/Windows reorganize test steps to isolate environment variables for JDK 25 aggregate coverage runs. ChangesWorkflow Security Hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Three small security-hardening tweaks to the workflows, continuing the audit started in #3357:
sonatype.yaml— deploy secrets (CI_DEPLOY_USERNAME,CI_DEPLOY_PASSWORD,NVD_API_KEY) moved from job-levelenv:to theDeploy to Sonatypestep'senv:. Same effective behavior today, but they're no longer in scope for any future step a contributor might add before the deploy.codeql-analysis.yml— adds workflow-levelpermissions: {}so the analyze job'sactions: read/contents: read/security-events: writeare explicit additive grants rather than trimming from GitHub's broad default. Mirrors the default-deny pattern shipped in GHA: add explicit "permissions: contents: read" to all read-only workflows #3357 for the other workflows.macos.yaml,windows.yaml— dropsGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}from the test stepenv:. The tests don't reference it and the equivalent Linux / PR / Unix test steps don't pass it.sonar.yamlandsite.yamllegitimately need it (PR decoration, gh-pages push) and are unchanged.Audit-item progress
This PR resolves two of the three follow-ups noted on #3357's PR description:
codeql-analysis.yml; all other workflows are single-job with appropriatepermissions: contents: read)sonatype.yaml)Action SHA-pinning audit also re-confirmed clean: all 71
uses:lines in.github/workflows/are SHA-pinned.Test plan
yaml.safe_load)GITHUB_TOKENenv removedGITHUB_TOKEN)Summary by CodeRabbit