GH-200 - Secure and optimize automation (15% of the exam) - Section 5.4

Pin third-party actions to full commit SHAs, enforce action usage policies and verify artifact attestations and provenance.

Pin third-party actions to a full commit SHA rather than a mutable tag to prevent supply-chain substitution attacks. Verify artifact attestations and provenance records and enforce action usage policies across the organisation.

pin to commit SHAaction usage policyartifact attestationprovenance

Practice question for this objective

Free sampleSecure and optimize automationmedium

A platform team consumes a third-party action in a release workflow and currently references it as a tag. A security review notes that the tag could be re-pointed by the maintainer to malicious code without the workflow file changing. Which reference form should the team adopt to guarantee that the exact reviewed code runs on every future workflow execution?

steps:
  - uses: some-org/deploy-action@<ref>
  • APin to the major version tag such as some-org/deploy-action@v3, because GitHub treats a major version tag as immutable once the maintainer has published a release for it.
  • BPin to the default branch such as some-org/deploy-action@main, because the branch reference tracks the maintainer's reviewed mainline and rejects any unreviewed force-pushed commits.
  • CPin to the full 40-character commit SHA such as some-org/deploy-action@a1b2c3d, because a commit SHA is immutable and always resolves to the exact tree the team reviewed. Correct
  • DPin to a patch version tag such as some-org/deploy-action@v3.2.1, because a fully qualified semantic version tag is locked to its release artifact and cannot be moved afterwards.
Pin third-party actions to a full commit SHA because a SHA is immutable while tags and branches are movable references. GitHub resolves a uses reference at run time, and tags and branches are mutable pointers that a maintainer can re-point to different commits, including malicious ones, without altering the workflow file. A full commit SHA names a single immutable commit, so pinning to it guarantees the exact reviewed tree runs on every execution, which is the GitHub-recommended hardening for third-party actions.

Why A is wrong: Tempting because major version tags are the common convenience reference, but a tag is a movable pointer the maintainer can re-point at any commit, so it does not guarantee the reviewed code keeps running.

Why B is wrong: Tempting because main feels authoritative, but a branch reference resolves to whatever commit is at the branch tip and updates silently on every push, so it is even less stable than a tag.

Why C is correct: A full commit SHA names one immutable commit that cannot be re-pointed, so the workflow always executes the exact reviewed code regardless of later tag or branch changes by the maintainer.

Why D is wrong: Tempting because a patch tag looks precise, but any tag including a patch tag is still a mutable Git reference the maintainer can delete and recreate against different code, so it is not a guarantee.

See more GH-200 practice questions, answers explained.

Exam traps in Secure and optimize automation

Answers that look right on this material and are not. Each one is a distractor from a different question in the GH-200 bank for this domain.

  • Pin the action to a short seven-character abbreviated commit SHA so the reference stays brief while still naming the reviewed commit

    Why it is wrong: An abbreviated SHA is tempting for brevity, but GitHub recommends the full-length SHA, and short forms can become ambiguous as the action repository grows.

  • The artifact-name input naming the upload-artifact entry, so the attestation is bound to the artifact label that later jobs download by

    Why it is wrong: An artifact name identifies an upload-artifact entry for transfer between jobs, but it is just a label and carries no content hash, so it cannot bind provenance to the exact bytes.

  • Add packages: write to the job permissions, because build provenance attestations are stored inside the GitHub Packages registry alongside the published container or binary they describe.

    Why it is wrong: Tempting because published artifacts often involve packages, but provenance attestations are recorded through the attestations permission, and packages: write only governs writing to the package registry itself.

Examworthy is not affiliated with or endorsed by GitHub. Original, blueprint-aligned practice material only.