For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cicd-github-unpinned-actions-full-length-commit-sha.md.
A documentation index is available at /llms.txt.
Steps that reference external GitHub Actions must be pinned to a full-length commit SHA to ensure the action’s code is immutable and to reduce supply-chain tampering or unexpected behavior from upstream updates. The rule inspects the uses property in step attributes and requires the value to end with @ followed by a 40-character lowercase hexadecimal commit SHA (pattern @[a-f0-9]{40}). Entries that do not match this pattern will be flagged. The check ignores local actions referenced with relative paths, starting with ./, and references beginning with actions/. When pinning, use a commit SHA from the action’s original repository so the pinned reference matches the intended source.
Secure example with a pinned action:
- name:Build and pushuses:docker/build-push-action@e3b0c44298fc1c149afbf4c8996fb92427ae41e4
name:Composite action with unpinned third-party actiondescription:Composite action that calls a third-party action by tag instead of SHAruns:using:compositesteps:- name:PR commentuses:thollander/actions-comment-pull-request@v2