Secure a GitHub Actions delivery workflow

8 steps · about 3 h 2 min · Intermediate

  1. Threat-model the workflow and its inputs (guide, GitHub Docs, 32 min)

    Identify where untrusted code, credentials and mutable dependencies cross trust boundaries.

  2. Reduce the workflow token permissions (guide, GitHub Docs, 20 min)

    Grant only the repository operations each job needs instead of relying on broad defaults.

  3. Scope and mask necessary secrets (guide, GitHub Docs, 22 min)

    Keep long-lived secrets out of source and expose them only to the jobs and environments that require them.

  4. Replace cloud keys with short-lived identity (guide, GitHub Docs, 24 min)

    Use workload identity claims so a leaked static credential is not the path to cloud deployment.

  5. Protect the deployment environment (guide, GitHub Docs, 22 min)

    Add reviewers, branch restrictions and scoped environment secrets around production promotion.

  6. Pin and review third-party actions (guide, GitHub Docs, 20 min)

    Bind dependencies to reviewed immutable revisions and inspect what privileged steps execute.

  7. Review dependency changes at the gate (guide, GitHub Docs, 18 min)

    Surface newly introduced packages and known risks before a pull request reaches delivery jobs.

  8. Attach and verify build provenance (guide, GitHub Docs, 24 min)

    Finish with evidence linking the released artifact to the controlled workflow and source revision.