Skip to content

Add GitHub Actions security policy requiring SHA pinning#8911

Merged
k8s-ci-robot merged 1 commit intokubernetes:mainfrom
Priyankasaggu11929:add-github-actions-policy
Mar 26, 2026
Merged

Add GitHub Actions security policy requiring SHA pinning#8911
k8s-ci-robot merged 1 commit intokubernetes:mainfrom
Priyankasaggu11929:add-github-actions-policy

Conversation

@Priyankasaggu11929
Copy link
Copy Markdown
Member

PR adds a a new policy to establish mandatory requirement for all GitHub Actions to use commit SHA hashes instead of mutable references (tags/branches) to prevent supply chain attacks.

ref: kubernetes/org#6235

@k8s-ci-robot k8s-ci-robot added the area/github-management Issues or PRs related to GitHub Management subproject label Mar 22, 2026
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 22, 2026
@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

cc: @dims

/hold
for review

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 22, 2026
@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

cc: @kubernetes/owners, @PushkarJ

@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

cc: @kubernetes/sig-security for review as well.

Copy link
Copy Markdown
Member

@PushkarJ PushkarJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Priyankasaggu11929 Left two comments to provide more clarity. Is there a plan from GitHub Admins to create a prow job that runs on PR or on schedule that checks for these policy violations? If yes, I am happy to co-maintain (or co-create) it with you all if you think it's worth doing.

1. All `uses:` statements in workflow files MUST reference actions using 40-character commit SHA hashes
2. New workflows MUST comply before merge
3. Existing workflows MUST be updated to comply
4. Repositories SHOULD enable Dependabot for GitHub Actions to automatically update SHA-pinned actions to newer versions
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will dependabot PR automatically know the right SHA to upgrade to or will default to version tags that are mutable? Although there is benefit in auto-upgrades if dependabot behavior is not going to be consistent to our policy, then it might be best to remove this point from the list.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to provide an example (or point at one) for dependabot?
https://github.com/kubernetes-sigs/kind/blob/main/.github/dependabot.yml is super helpful to me and I'll likely copy-pasta it into my project

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should have been including ok-to-test

Copy link
Copy Markdown
Member Author

@Priyankasaggu11929 Priyankasaggu11929 Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should have been including ok-to-test

Ah, just re-read it.

You meant this dependabot yaml adding ok-to-test - https://github.com/kubernetes-sigs/kind/blob/main/.github/dependabot.yml

I think, we should not and let some project maintainer do it going forward?

(that would need a further cleanup but I also think it is worth it?)


@PushkarJ, @adrianmoisey - I kept the dependabot pointers, because even after enforcing the policy at enterprise level, we will still need to continue maintaining them and that's where dependabot will help.

Added example reference from the github docs on how to setup.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Actions being able to forcibly apply labels is a big problem for our label based workflows, there are probably repos adding lgtm and approved as well ...

Comment thread github-management/github-actions-policy.md Outdated
@upodroid
Copy link
Copy Markdown
Member

Hey, GitHub has setting to enforce this and activating it should be sufficient.

@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

Priyankasaggu11929 commented Mar 23, 2026

Thanks for the review folks.

@PushkarJ - addressing the above comments here.

Yes, the plan was to add a periodic job that scans and flags for the unintended gh actions usage across our gh orgs. But I think with the suggestion from @upodroid, we will covered.

Will also remove the dependabot reference.

And add the common branches (master, main) for clarity.


@upodroid - could you provide a pointer on the setting (in a DM or a docs link here - either would work), i will toggle it tomorrow and we can announce it on dev@... mailing list.


For this week, I am trying to focus on all immediate things we need either fixing or enforcing to address the impact.

but yes, over the next month, i can try to add more periodic jobs if we would still need some.

@upodroid
Copy link
Copy Markdown
Member

@PushkarJ
Copy link
Copy Markdown
Member

Sounds good @Priyankasaggu11929, I can LGTM once the PR is updated and yes, good call on taking care of preventive and detective steps after we finish the immediate task at hand.

@upodroid thanks for the pointer. Good to know about this feature!

@@ -0,0 +1,33 @@
The purpose of this policy is to establish mandatory security requirements while using GitHub Actions in workflow files across all repositories under all Kubernetes github organizations.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently we can enforce this via org policy (via @upodroid ), I think we should pursue that route.
It's hard to get people to read more 😅

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe both? This documents the rationale behind the org level policy and then once enforced we add a link to actual org level setting in this sharing that it's in effect.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can be. (ref for GH admins: https://github.com/enterprises/kubernetes/settings/actions)

Comment thread github-management/github-actions-policy.md
@Priyankasaggu11929 Priyankasaggu11929 force-pushed the add-github-actions-policy branch from 443937a to 3b289a4 Compare March 25, 2026 05:30
@Priyankasaggu11929 Priyankasaggu11929 force-pushed the add-github-actions-policy branch from 3b289a4 to 3bab028 Compare March 25, 2026 05:47
@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

@kubernetes/owners - should we enforce the policy Require actions to be pinned to a full-length commit SHA at enterprise level immediately? or inform with a deadline and then enforce?

We have about ~200 repos using GH Actions and roughly ~144 of them are using non-sha references. So, I'm assuming all of these will immediately break.

@cblecker
Copy link
Copy Markdown
Member

My opinion: I think we should give a notice period of maybe 2 weeks for repos to update this?

@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

My opinion: I think we should give a notice period of maybe 2 weeks for repos to update this?

+1. If others don't have objection, then I'll send an email in the evening (Amsterdam time) on the dev@... mailing list, sharing this policy as a PSA and asking folks to update their github actions accordingly to adhere the policy. Will put a deadline of April 15 - that will give folks enough time to act on it.

@cblecker, @PushkarJ - could you help merging this PR by then, that would be helpful then to link the merged policy. I have addressed all comments so far.

@dims
Copy link
Copy Markdown
Member

dims commented Mar 25, 2026

If others don't have objection, then I'll send an email in the evening (Amsterdam time) on the dev@... mailing list

yes please

Copy link
Copy Markdown
Member

@PushkarJ PushkarJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

(Lets announce a date and then enforce)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2026
@PushkarJ
Copy link
Copy Markdown
Member

/assign cblecker

(For approval)

@cblecker
Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker, Priyankasaggu11929

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 26, 2026
@k8s-ci-robot k8s-ci-robot merged commit ca9288b into kubernetes:main Mar 26, 2026
3 checks passed
k8s-ci-robot added a commit to kubernetes-sigs/kubebuilder that referenced this pull request Mar 27, 2026
🐛 (go/v4): Pin GitHub Actions to commit SHA hashes to improve security and align with the latest GitHub Actions security policy. For more details, see kubernetes/community#8911.
@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

The PSA was shared with the dev@kubernetes.io mailing list on March 27 - https://groups.google.com/a/kubernetes.io/g/dev/c/gvwLzCBx-hA/m/phP47p52AgAJ, with the following "Immediate Action Required"

Project maintainers are requested to update their GitHub Actions workflows to comply with this policy by April 15, 2026.
After this date, the Kubernetes project will enforce the "Require actions to be pinned to a full-length commit SHA" policy at the enterprise level, and any github action workflows using mutable references will fail to run.

We have reached the timeline (April 15) we put for enforcing the policy.

I'm going to turn on the "Require actions to be pinned to a full-length commit SHA" policy at the Kubernetes enterprise level today.

Before I do so, pinging once again (@kubernetes/owners, @PushkarJ, @dims) for a +1.

@jasonbraganza
Copy link
Copy Markdown
Member

+1

Better safe, than sorry.

@dims
Copy link
Copy Markdown
Member

dims commented Apr 15, 2026

+1

Would we need comms? (will actions stop running until they are compliant?)

@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

Would we need comms?

I plan to send an update on the earlier PSA email to inform folks, after I flip the setting.

(will actions stop running until they are compliant?)

The GH policy Docs doesn't confirm if its a preventive or retroactive policy.

So, I'm going with assumption that all GH Action workflows with mutable references will start failing until fixed.

I added a note about it in the PSA:

After this date, the Kubernetes project will enforce the "Require actions to be pinned to a full-length commit SHA" policy at the enterprise level, and any github action workflows using mutable references will fail to run.

@PushkarJ
Copy link
Copy Markdown
Member

Seems like it is retroactive for new runs as per this: kubernetes/test-infra#36726 (comment)

Good call to add it in PSA. +1 from me

@Priyankasaggu11929
Copy link
Copy Markdown
Member Author

Priyankasaggu11929 commented Apr 16, 2026

Thanks folks. I will go ahead and toggle the "Require actions to be pinned to a full-length commit SHA" button now.


Update - The policy is enforced now at the Kubernetes Enterprise level.

Sent update on dev@kubernetes.io mailing list - https://groups.google.com/a/kubernetes.io/g/dev/c/gvwLzCBx-hA/m/u2Tt-5U8CAAJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/github-management Issues or PRs related to GitHub Management subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants