GH-200 practice question 6 of 15
As a developer, what is the safest way to reference an action to prevent modification of the underlying code?
Full set: 100 questionsUsing a full-length commit SHA (Secure Hash Algorithm) is the safest and most immutable way to reference a GitHub Action. A commit SHA uniquely identifies a specific version of the code at a single point in time. Unlike branches or tags, which are pointers that can be moved to different commits, a SHA is permanent. This guarantees that your workflow will always execute the exact same code, protecting it from potentially malicious or breaking changes that could be introduced if referencing a mutable tag or branch.
B. Use a branch name: A branch is a mutable pointer; code on the branch can change at any time, introducing instability or security risks.
C. Use a patch release tag: Tags are mutable. They can be deleted and re-created to point to a different commit, making them less secure than a SHA.
D. Use a major release tag: Like other tags, major release tags can be moved, posing the same security and stability risks.
GitHub Docs
"Security hardening for GitHub Actions". The section "Using third-party actions" explicitly states: "Pinning an action to a full length commit SHA is the most secure option... This will ensure you are using an immutable version of the action."
GitHub Docs
"Using actions in a workflow". This document shows the syntax for referencing actions using a branch
tag
or a specific commit SHA
noting the trade-offs.
Keep practicing
Take the free GH-200 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other GH-200 practice questions
- Question 1Which action type should be used to bundle a series of run steps into a reusable custom a…
- Question 2As a developer, which workflow steps should you perform to publish an image to the GitHub…
- Question 3Where should workflow files be stored to be triggered by events in a repository?
- Question 5Which default environment variable specifies the branch or tag that triggered a workflow?
- Question 7Without the need to use additional infrastructure, what is the simplest and most maintain…
- Question 8Disabling a workflow allows you to stop a workflow from being triggered without having to…
