🌱 Chore: harden git workflows#13442
Conversation
|
Welcome @PrashantR30! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @PrashantR30. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
🌱 Harden GitHub Actions workflows
What this PR does / why we need it:
Hardens several CI workflows against credential leakage and privilege escalation:
persist-credentials: falseadded to allactions/checkoutsteps that do not require pushing back to the repository. By default,actions/checkoutpersists theGITHUB_TOKENin.git/config, which can be inadvertently leaked if a workflow uploads artifacts.pr-verify.yaml:pull_request_targetreplaced withpull_request: this is the most significant fix.pull_request_targetruns with base-repo privileges and access to secrets. Since this workflow checks out repo code and executes./hack/verify-pr-title.sh, a malicious fork PR could modify that script and run arbitrary code with elevated privileges. Switching topull_requestremoves that risk entirely, as title validation requires no elevated permissions.permissions: {}added topr-verify.yamlwhich was missing an explicit permissions block.fetch-depth: 1added toweekly-md-link-check.yamlandweekly-security-scan.yamlas full git history is unnecessary for link checking and security scanning.Which issue(s) this PR fixes:
Fixes #
Changes:
pr-golangci-lint.yamlpersist-credentials: falsepr-md-link-check.yamlpersist-credentials: falsepr-verify.yamlpull_request_targetreplaced bypull_request,permissions: {},persist-credentials: falseweekly-md-link-check.yamlpersist-credentials: false,fetch-depth: 1weekly-security-scan.yamlpersist-credentials: false,fetch-depth: 1weekly-test-release.yamlpersist-credentials: false/area ci