Skip to content

CICD-182 · Validate a candidate digest before use ​

Encyclopedia · Workflow security fundamentals · All snippets

Previous · CICD-181 · Next · CICD-183

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites trusted repository, verified inputs and read-only default access.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters DIGEST.

2. Copy the snippet ​

bash
[[ "${DIGEST:?}" =~ ^sha256:[0-9a-f]{64}$ ]]

3. How it works ​

The regular expression validates the shape of an immutable SHA-256 digest. Provenance and artifact retrieval remain separate verification steps.

4. Verify the result ​

Reject tag-only and malformed inputs before deployment.

Validation syntax-validated (Bash parse). Status definitions.