ci: harden GitHub Actions token and input handling - #2008
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe pull request hardens GitHub Actions checkout and token handling, passes release values through environment variables, updates a publishing action revision, and removes the tag documentation generation workflow and script with a corresponding proposal reference cleanup. ChangesWorkflow maintenance
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull request overview
This PR hardens GitHub Actions token usage and shell input handling by reducing default GITHUB_TOKEN privileges, limiting credential persistence on checkouts, and deferring higher-privilege GitHub App token minting until just before PR creation. It also removes legacy, nonfunctional tag-documentation automation.
Changes:
- Reduce default workflow/job token privileges and disable persisted checkout credentials in read-only jobs.
- Mint GitHub App tokens only immediately before PR creation, with narrowly scoped
contents: write/pull-requests: write. - Avoid direct
${{ }}interpolation in shell commands by passing values via step-local environment variables; remove obsolete tag doc workflow/script and update action pins.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/proposals/repo-restructure.md | Removes obsolete proposal reference to the deleted tag-doc generator. |
| build/Update-TagsDocumentation.ps1 | Removes legacy tag documentation generator script. |
| .github/workflows/update-tag-documentation.yml | Removes legacy workflow that attempted to generate/commit tag docs. |
| .github/workflows/update-role-definitions.yaml | Uses read-only checkout token; mints App token only for PR creation; disables persisted creds. |
| .github/workflows/update-public-suffix-list.yaml | Reduces default job token to contents: read; mints App token only for PR creation; disables persisted creds. |
| .github/workflows/update-module-docs.yaml | Uses read-only checkout token; mints App token only for PR creation; disables persisted creds. |
| .github/workflows/build-docs.yaml | Uses read-only checkout token; mints App token only for PR creation; disables persisted creds. |
| .github/workflows/publish-versioned-docs.yml | Passes input version to Node via step env var (safer shell argument handling). |
| .github/workflows/publish-tests.yaml | Disables persisted checkout creds; passes release tag via env vars; updates cpina action pin. |
| .github/workflows/publish-module.yaml | Passes module version via env vars into PowerShell/Node steps. |
| .github/workflows/publish-module-preview.yaml | Passes module version via env vars into PowerShell/Node steps. |
| .github/workflows/publish-module-manualversionupdate.yaml | Passes module version via env vars into PowerShell/Node steps. |
| .github/workflows/opengrep.yml | Disables persisted checkout creds in scan job. |
| .github/workflows/maester-action-smoke-test.yaml | Aligns checkout pin to actions/checkout v7.0.1 SHA. |
| .github/workflows/dependency-review.yaml | Disables persisted checkout creds for dependency review job. |
| .github/workflows/codeql.yml | Disables persisted checkout creds (but currently introduces invalid YAML indentation in steps). |
| .github/workflows/build-website.yaml | Disables persisted checkout creds across website build jobs. |
| .github/workflows/build-maester-report-template.yaml | Disables persisted checkout creds in report-template build job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I love the intent and the goal of this PR! The one thing I want to check: the newer test auto-documentation workflow doesn't completely replace what the tag documentation workflow does (as far as I have seen). Let's see if we can find a way to get feature parity before the tag documentation is removed. As an aside, I think the last website reorganization resulted in some valuable pages being lost from the navigation structure and I'd like to see some of those recovered as well. |
I was under the impression that I could be wrong on both points, but that's how it seemed to me. It would be good if someone else could verify or disprove :) |
I didn't think that workflow was even a year old? |
You're right - it was introduced in commit d2ddee1 in December 2025. What I meant was that based on the run history since it was implemented, the workflow doesn't appear to have produced a commit. I phrased that poorly. |
📑 Description
Hardens GitHub Actions token and input handling while preserving active automation behavior:
GITHUB_TOKENinupdate-public-suffix-listtocontents: read.contents: writeandpull-requests: write.update-tag-documentationworkflow and its sole-purposebuild/Update-TagsDocumentation.ps1generator. GitHub records 116 runs from January 19 through July 25, including 73 on non-main branches. Those runs performed checkout withcontents: write, installed Pester, discovered tests, and wrotewebsite/docs/tests/tags/readme.md; however, after the generator moved to that path, the commit step continued checkingwebsite/docs/tags.md, loggedNo changes to commit, and discarded the generated change. Repository history contains no matchingchore: update tags documentationbot commit. Since May,website/scripts/generate-test-docs.mjshas owned the current linked tag index and is enforced by the website checks and prebuild, so removing the legacy workflow and script eliminates nonfunctional automation without removing active documentation behavior.cpina/github-action-push-to-another-repositorypin to the immutablev1.7.3SHA and aligns the smoke-test checkout pin withv7.0.1.The persisted checkout credentials in publish jobs remain an accepted residual because
stefanzweifel/git-auto-commit-actionrequires them for its later push. Existing active triggers, jobs, matrices, artifacts, branches, tags, inputs, release fallback behavior, and generated outputs remain unchanged.Supporting guidance:
actions/create-github-app-tokenpermissionspeter-evans/create-pull-requesttoken guidanceactions/checkoutcredential persistencestefanzweifel/git-auto-commit-actioncheckout requirement✅ Checks
/powershell/tests/pester.ps1locally.Local validation completed:
Update-TagsDocumentationreferences remain.cpinav1.7.3and checkoutv7.0.1SHAs.npm --prefix website run check-test-docspassed and checked 407 generated test-documentation pages.git diff --check upstream/mainpassed.Common.Tests.ps1for more than 15 minutes. The local run was stopped and is not reported as passing; the required Ubuntu, Windows, and macOSbuild-validationjobs are the authoritative full-suite result.Current PR checks for commit
e951cbc3:npm run check-test-docsand failed only because the pre-existing generated contributor snapshotwebsite/src/data/contributors.jsonis stale.build-validationjobs each ran 10,224 tests and reported the same nine failures: the Global Secure Access functions added in Add 9 Global Secure Access checks (MT.1187–MT.1195) [Preview] #1992 do not satisfy the repository-wideWrite-Verbosepolicy test. This PR does not change those functions, and an unrelated PR run immediately before this one failed on the same checks, so no unrelated GSA implementation was added to this focused workflow-hardening change.ℹ️ Additional Information
No repository variables, secrets, environments, generated command documentation, generated test documentation, module output, or runtime dependencies are added or changed. No prior issue is required for this focused maintenance change.
Summary by CodeRabbit
Security
Maintenance
Removed