From 71971945fb75bf1b65be86f4edb0a93d51406ff6 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 30 May 2026 12:44:12 +0000 Subject: [PATCH] fix(ci): remove shell-injection risk in release workflows, re-enable semgrep --error Move untrusted github-context values (event.inputs.version, event.inputs.package_managers, event.inputs.dry_run, ref_name, event.release.tag_name) into step-level env: vars and reference them as quoted shell variables, per semgrep run-shell-injection. With all 9 findings resolved, restore --error on semgrep so real findings block CI. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/desktop-release.yml | 9 ++++++--- .github/workflows/submit-packages.yml | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index 29b617c..d15eebd 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -160,11 +160,14 @@ jobs: - name: Get version id: version + env: + INPUT_VERSION: ${{ github.event.inputs.version }} + REF_NAME: ${{ github.ref_name }} run: | - if [ -n "${{ github.event.inputs.version }}" ]; then - VERSION="${{ github.event.inputs.version }}" + if [ -n "$INPUT_VERSION" ]; then + VERSION="$INPUT_VERSION" else - VERSION="${{ github.ref_name }}" + VERSION="$REF_NAME" fi # Strip 'v' prefix if present VERSION="${VERSION#v}" diff --git a/.github/workflows/submit-packages.yml b/.github/workflows/submit-packages.yml index 7bab6f6..8700547 100644 --- a/.github/workflows/submit-packages.yml +++ b/.github/workflows/submit-packages.yml @@ -71,11 +71,14 @@ jobs: - name: Determine version id: version + env: + INPUT_VERSION: ${{ github.event.inputs.version }} + RELEASE_TAG: ${{ github.event.release.tag_name }} run: | - if [ -n "${{ github.event.inputs.version }}" ]; then - VERSION="${{ github.event.inputs.version }}" - elif [ -n "${{ github.event.release.tag_name }}" ]; then - VERSION="${{ github.event.release.tag_name }}" + if [ -n "$INPUT_VERSION" ]; then + VERSION="$INPUT_VERSION" + elif [ -n "$RELEASE_TAG" ]; then + VERSION="$RELEASE_TAG" else VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "") fi @@ -86,8 +89,10 @@ jobs: - name: Determine package managers id: pms + env: + INPUT_PACKAGE_MANAGERS: ${{ github.event.inputs.package_managers }} run: | - INPUT_PMS="${{ github.event.inputs.package_managers }}" + INPUT_PMS="$INPUT_PACKAGE_MANAGERS" if [ -z "$INPUT_PMS" ]; then INPUT_PMS="all" fi @@ -104,10 +109,11 @@ jobs: - name: Submit to package managers if: steps.pms.outputs.package_managers != '' + env: + DRY_RUN: ${{ github.event.inputs.dry_run }} run: | VERSION="${{ steps.version.outputs.version }}" PMS="${{ steps.pms.outputs.package_managers }}" - DRY_RUN="${{ github.event.inputs.dry_run }}" ARGS="-v $VERSION"