Skip to content

Add SLSA generic generator workflow#1573

Open
paulthanson082-glitch wants to merge 3 commits intogithub:mainfrom
paulthanson082-glitch:main
Open

Add SLSA generic generator workflow#1573
paulthanson082-glitch wants to merge 3 commits intogithub:mainfrom
paulthanson082-glitch:main

Conversation

@paulthanson082-glitch
Copy link

This workflow generates SLSA provenance files for projects, satisfying level 3 requirements. It includes steps for building artifacts and generating subjects for provenance.

This workflow generates SLSA provenance files for projects, satisfying level 3 requirements. It includes steps for building artifacts and generating subjects for provenance.
Copilot AI review requested due to automatic review settings February 5, 2026 14:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a GitHub Actions workflow for generating SLSA (Supply chain Levels for Software Artifacts) provenance files, which helps improve software supply chain security by providing verifiable information about how artifacts were built. The workflow consists of two jobs: one that builds artifacts and generates their SHA256 hashes, and another that generates SLSA Level 3 provenance metadata.

Changes:

  • Added a new workflow file that generates SLSA provenance for build artifacts
  • Configured the workflow to trigger on release creation and manual dispatch
  • Set up appropriate permissions for SLSA provenance generation and release asset uploads

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# List the artifacts the provenance will refer to.
files=$(ls artifact*)
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a mismatch between the output variable name and its usage. The script sets the output as "hashes" but it's referenced as "digests" in the job outputs (line 23) and when passed to the provenance job (line 65). This will cause the workflow to fail because the output variable will be undefined. Change "hashes" to "digests" to match the expected output name.

Suggested change
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
echo "digests=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"

Copilot uses AI. Check for mistakes.
@paulthanson082-glitch
Copy link
Author

@copilot open a new pull request to apply changes based on the comments in this thread

@paulthanson082-glitch
Copy link
Author

Nice

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 5, 2026 14:22
@paulthanson082-glitch
Copy link
Author

@copilot open a new pull request to apply changes based on the comments in this thread

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@paulthanson082-glitch
Copy link
Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# List the artifacts the provenance will refer to.
files=$(compgen -G "artifact*" || true)
if [ -z "$files" ]; then
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output variable name is inconsistent. Line 59 sets the output as 'hashes' but line 23 references it as 'digests'. This will cause the workflow to fail because the provenance job will receive an empty value.

Change line 59 to use 'digests' instead of 'hashes' to match the output reference, or update line 23 to reference 'hashes' instead of 'digests'.

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +44
with:
name: build-artifacts
path: artifact*
# ========================================================
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions "all binaries that you generate provenance for" but the example code generates text files, not binaries. This inconsistency between the comment and the example could be confusing.

Consider updating the comment to be more generic (e.g., "all artifacts") or updating the example to generate actual binary artifacts to match the comment.

Copilot uses AI. Check for mistakes.
Comment on lines +58 to +64
files=$(compgen -G "artifact*" || true)
if [ -z "$files" ]; then
echo "Error: no artifacts found matching pattern 'artifact*'." >&2
exit 1
fi
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable files may contain newlines if multiple files match the pattern, which could cause issues with the unquoted variable expansion in the sha256sum command on line 59. If filenames contain spaces or special characters, this could lead to incorrect behavior or security issues.

Consider using a safer approach such as:

  • Using an array to store filenames
  • Quoting the variable properly
  • Using find with -print0 and xargs -0 for more robust file handling
Suggested change
files=$(compgen -G "artifact*" || true)
if [ -z "$files" ]; then
echo "Error: no artifacts found matching pattern 'artifact*'." >&2
exit 1
fi
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
mapfile -t files < <(compgen -G "artifact*" || true)
if [ "${#files[@]}" -eq 0 ]; then
echo "Error: no artifacts found matching pattern 'artifact*'." >&2
exit 1
fi
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum "${files[@]}" | base64 -w0)" >> "${GITHUB_OUTPUT}"

Copilot uses AI. Check for mistakes.
needs: [build]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow sets upload-assets: true which attempts to upload provenance to a release, but the workflow can be triggered by workflow_dispatch (manual trigger) when there is no release event. This will cause the provenance job to fail when manually triggered.

Consider either:

  1. Removing workflow_dispatch from the triggers if assets should only be uploaded during releases
  2. Making upload-assets conditional based on the trigger type
  3. Setting upload-assets: false and handling asset uploads separately

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant