Always emit persist-credentials: false with actions/checkout#2641
Conversation
- Updated compiler_yaml.go to add persist-credentials: false to main job checkout - Updated buildCheckoutRepository in push_to_pull_request_branch.go - Updated copilot_participant_steps.go checkout - Updated create_agent_task.go checkout - Added test file checkout_persist_credentials_test.go to verify the change - Recompiled all workflows to apply the change Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
persist-credentials: false with actions/checkout
|
Agentic Changeset Generator triggered by this pull request. |
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a security concern by enforcing persist-credentials: false on all actions/checkout steps across the entire codebase to prevent the GITHUB_TOKEN from persisting in git configuration after checkout.
Key changes:
- Updated 4 source code locations that generate checkout steps
- Added comprehensive test coverage to validate the security parameter across all checkout scenarios
- Regenerated all 65 workflow lock files with the new security configuration
Reviewed Changes
Copilot reviewed 62 out of 62 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/compiler_yaml.go |
Added persist-credentials to main job checkout generation |
pkg/workflow/push_to_pull_request_branch.go |
Added persist-credentials to PR branch checkout helper |
pkg/workflow/copilot_participant_steps.go |
Added persist-credentials to Copilot participant checkout |
pkg/workflow/create_agent_task.go |
Added persist-credentials to agent task checkout |
pkg/workflow/checkout_persist_credentials_test.go |
New comprehensive test validating persist-credentials across all scenarios |
.github/workflows/go.mod |
Added empty require block (unrelated formatting change) |
.github/workflows/*.lock.yml (65 files) |
Regenerated workflow files with persist-credentials parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| require ( | ||
| ) |
There was a problem hiding this comment.
The addition of an empty require () block appears unnecessary and unrelated to the PR's purpose of adding persist-credentials: false. This change adds no functional value and should be removed to keep the PR focused on its security objective.
| require ( | |
| ) |
Prevents GITHUB_TOKEN from persisting in git config after checkout by always emitting
persist-credentials: falsein all generatedactions/checkoutsteps.Changes
Updated 4 checkout generation sites:
compiler_yaml.go: Main job checkoutpush_to_pull_request_branch.go:buildCheckoutRepository()helpercopilot_participant_steps.go: Participant checkoutcreate_agent_task.go: Agent task checkoutAdded test coverage:
checkout_persist_credentials_test.govalidates persist-credentials is emitted across all checkout scenariosRecompiled workflows: All 65
.lock.ymlfiles updated with the security parameterExample
Generated checkout steps now include:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.