Skip to content

[Security] Pin GitHub Actions to a full-length commit SHA#8

Closed
juliendoutre wants to merge 1 commit intomainfrom
pin-github-actions-1773666588
Closed

[Security] Pin GitHub Actions to a full-length commit SHA#8
juliendoutre wants to merge 1 commit intomainfrom
pin-github-actions-1773666588

Conversation

@juliendoutre
Copy link
Copy Markdown

Pin GitHub Actions to SHA hashes

This automated PR pins third-party GitHub Actions references from mutable tag versions (e.g., @v4) to their corresponding SHA hashes (e.g., @abc123...). The original tag is preserved as a comment for readability. Your workflows will work exactly the same way. Internal actions (under the DataDog organization) are not pinned.

Read https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions for more details and info on how to configure this for entire repos.

Why pin GitHub Actions?

Git tags are mutable: they can be moved to point to different commits at any time. A compromised or malicious action maintainer could update a tag to inject arbitrary code into your CI workflows (see the tj-actions incident). Pinning to SHA hashes ensures you always run the exact code you reviewed, protecting your repository from supply chain attacks such as the tj-actions incident.

What if something breaks?

If a pinned action doesn't work for your use case, you can push a commit directly to this branch to fix it. As a last resort, reach out to #sdlc-security on Slack.

Set up Dependabot or Renovate for automatic updates

Once actions are pinned to SHA hashes, you should configure Dependabot or Renovate to receive weekly update PRs when new versions are available.

In the case of Dependabot, create or update .github/dependabot.yml:

version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    groups:
      github-actions:
        patterns:
          - "*"
    open-pull-requests-limit: 10

Dependabot will automatically propose PRs that update both the SHA hash and the version comment like in this example.


This PR was automatically generated by the GitHub Actions Pinning tool, owned by #sdlc-security.

@juliendoutre juliendoutre requested a review from iksaif as a code owner March 16, 2026 13:09
@iksaif
Copy link
Copy Markdown
Collaborator

iksaif commented Mar 21, 2026

Can you resolve the conflicts ?

@iksaif
Copy link
Copy Markdown
Collaborator

iksaif commented Mar 21, 2026

Closing as superseded — actions are already pinned to newer versions in main.

@iksaif iksaif closed this Mar 21, 2026
@juliendoutre
Copy link
Copy Markdown
Author

@iksaif I don't see the main branch actions being pinned by hash: https://github.com/DataDog/adipo/tree/main/.github/workflows
Should we reopen this PR?

@iksaif
Copy link
Copy Markdown
Collaborator

iksaif commented Mar 23, 2026

I pinned newer versions .. but using versions not hash ! (could we make dependabot just update the hashs and not the versions ?)

@juliendoutre
Copy link
Copy Markdown
Author

juliendoutre commented Mar 23, 2026

Versions tags are mutable so less reliable than hashes. Dependabot automatically bumps the hash and the commented version tag next to it yes.

@iksaif
Copy link
Copy Markdown
Collaborator

iksaif commented Mar 23, 2026

ok pushing a commit to do this now

@juliendoutre
Copy link
Copy Markdown
Author

ok pushing a commit to do this now

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants