Skip to content

Commit d8e5785

Browse files
authored
fix(CI): use intermediate env variable to prevent TAG injection (#2603)
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
1 parent 9115af0 commit d8e5785

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/github_release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
CHAINLOOP_WORKFLOW_NAME: chainloop-vault-release
2929
CHAINLOOP_PROJECT: chainloop
3030
GH_TOKEN: ${{ github.token }}
31+
INPUT_TAG: ${{ inputs.tag }}
3132
steps:
3233
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3334

@@ -37,12 +38,12 @@ jobs:
3738
3839
- name: Initialize Attestation
3940
run: |
40-
tag=$(echo -n ${{inputs.tag}} | cut -d / -f3)
41+
tag=$(echo -n "$INPUT_TAG" | cut -d / -f3)
4142
chainloop attestation init --workflow ${CHAINLOOP_WORKFLOW_NAME} --project ${CHAINLOOP_PROJECT} --version "$tag"
4243
4344
- name: Attest all assets
4445
run: |
45-
tag=$(echo -n ${{inputs.tag}} | cut -d / -f3)
46+
tag=$(echo -n "$INPUT_TAG" | cut -d / -f3)
4647
gh release download $tag -D /tmp/github-release
4748
for entry in $(ls /tmp/github-release); do
4849
# If the name is cas.cyclonedx.json, controlplane.cyclonedx.json or cli.cyclonedx.json, we need to add the attestation with the correct name
@@ -83,7 +84,7 @@ jobs:
8384
if: ${{ success() }}
8485
run: |
8586
chainloop_release_url="## Chainloop Attestation"$'\n'"[View the attestation of this release](https://app.chainloop.dev/attestation/${{ steps.attestation-push.outputs.attestation_sha }})"
86-
current_notes=$(gh release view ${{inputs.tag}} --json body -q '.body')
87+
current_notes=$(gh release view "$INPUT_TAG" --json body -q '.body')
8788
8889
if echo "$current_notes" | grep -q "## Chainloop Attestation"; then
8990
# Replace the existing Chainloop Attestation section with the new URL
@@ -94,4 +95,4 @@ jobs:
9495
fi
9596
9697
# Update the release notes and ignore if it fails since we might be lacking permissions to update the release notes
97-
gh release edit ${{inputs.tag}} -n "$modified_notes" || echo -n "Not enough permissions to edit the release notes. Skipping..."
98+
gh release edit "$INPUT_TAG" -n "$modified_notes" || echo -n "Not enough permissions to edit the release notes. Skipping..."

0 commit comments

Comments
 (0)