security(release): keep app-title and version metadata out of shell source (#47)

draft-release and resolve-version interpolated caller-provided metadata directly
into Bash source (CWE-78):

- draft-release embedded app-title into the `title=` assignment in the step that
  has GH_TOKEN available.
- resolve-version embedded input-version into a `v=` assignment before it was
  validated, and app-title into the job-summary `echo`.

Both inputs now travel through the step `env:` and are read with quoted variable
expansions; the version is validated before it is used to produce outputs, and
the summary is written with a fixed `printf` format. No change to outputs or
release behavior.
This commit is contained in:
Dylan M. Taylor authored and GitHub committed 2026-10-22 11:40:30 -04:00
1 parent a4acae8e3a
commit d04f2a42da
2 files changed
+7 -3

No files matched your search

+2 -1
View File
@@ -37,12 +37,13 @@ runs:
working-directory: artifacts
env:
VERSION: ${{ inputs.version }}
APP_TITLE: ${{ inputs.app-title }}
PRERELEASE: ${{ inputs.prerelease }}
GH_TOKEN: ${{ inputs.github-token }}
GH_REPO: ${{ github.repository }}
run: |
tag="v$VERSION"
title="${{ inputs.app-title }} v$VERSION"
title="$APP_TITLE v$VERSION"
pre=()
if [ "$PRERELEASE" = "true" ]; then pre=(--prerelease); fi
if draft="$(gh release view "$tag" --json isDraft --jq .isDraft 2>/dev/null)"; then
+5 -2
View File
@@ -28,13 +28,16 @@ runs:
- id: resolve
name: Resolve version
shell: bash
env:
INPUT_VERSION: ${{ inputs.input-version }}
APP_TITLE: ${{ inputs.app-title }}
run: |
if [ -f packaging/env.sh ]; then
. packaging/env.sh
elif [ -f packaging/common.sh ]; then
. packaging/common.sh
fi
v="${{ inputs.input-version }}"
v="$INPUT_VERSION"
v="${v#v}"
v="${v:-$VERSION}"
if ! printf '%s' "$v" | grep -Eq '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'; then
@@ -47,4 +50,4 @@ runs:
echo "date=$(date -u +%Y-%m-%d)"
echo "prerelease=$pre"
} >>"$GITHUB_OUTPUT"
echo "### ${{ inputs.app-title }} v$v (\`${GITHUB_SHA::9}\`)" >>"$GITHUB_STEP_SUMMARY"
printf '### %s v%s (`%s`)\n' "$APP_TITLE" "$v" "${GITHUB_SHA::9}" >>"$GITHUB_STEP_SUMMARY"