Skip to content

Create generator-generic-ossf-slsa3-publish.yml#1

Open
Draco7587 wants to merge 1 commit intomasterfrom
Draco7587-patch-1
Open

Create generator-generic-ossf-slsa3-publish.yml#1
Draco7587 wants to merge 1 commit intomasterfrom
Draco7587-patch-1

Conversation

@Draco7587
Copy link
Owner

No description provided.

Comment on lines +21 to +57
runs-on: ubuntu-latest
outputs:
digests: ${{ steps.hash.outputs.digests }}

steps:
- uses: actions/checkout@v4

# ========================================================
#
# Step 1: Build your artifacts.
#
# ========================================================
- name: Build artifacts
run: |
# These are some amazing artifacts.
echo "artifact1" > artifact1
echo "artifact2" > artifact2
# ========================================================
#
# Step 2: Add a step to generate the provenance subjects
# as shown below. Update the sha256 sum arguments
# to include all binaries that you generate
# provenance for.
#
# ========================================================
- name: Generate subject for provenance
id: hash
run: |
set -euo pipefail
# List the artifacts the provenance will refer to.
files=$(ls artifact*)
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
provenance:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 months ago

To remediate this issue, add a permissions block to the build job, specifying the minimum privileges required for its steps. The build job only checks out code and builds artifacts without requiring any write access or interacting with pull requests, issues, or releases. The minimal required permission is contents: read, allowing the job to check out the repository's code.

To fix, insert a permissions: section in the build job (under line 21, before outputs:) as follows:

permissions:
  contents: read

No new imports or definitions are required. Only the YAML block for the job needs updating.


Suggested changeset 1
.github/workflows/generator-generic-ossf-slsa3-publish.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/generator-generic-ossf-slsa3-publish.yml b/.github/workflows/generator-generic-ossf-slsa3-publish.yml
--- a/.github/workflows/generator-generic-ossf-slsa3-publish.yml
+++ b/.github/workflows/generator-generic-ossf-slsa3-publish.yml
@@ -19,6 +19,8 @@
 jobs:
   build:
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     outputs:
       digests: ${{ steps.hash.outputs.digests }}
 
EOF
@@ -19,6 +19,8 @@
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
digests: ${{ steps.hash.outputs.digests }}

Copilot is powered by AI and may make mistakes. Always verify output.
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