From 2dcabd669d9e4ae05b122d8236a0efd71da282a3 Mon Sep 17 00:00:00 2001 From: Diego OJ Date: Sun, 15 Nov 2026 16:30:08 -0300 Subject: [PATCH 1/2] Fix | PyPI test release workflow: read-only token, version input via env CodeQL (actions/missing-workflow-permissions) flagged the workflow for not declaring permissions. The job only checks out and uploads with PYPI_TOKEN, so contents: read is enough. The version input also went into the script via ${{ }}; it now goes through an env var so it can't inject shell code. Co-Authored-By: Claude Opus 5.5 --- .../release-pypi-build-push-test-package.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-pypi-build-push-test-package.yml b/.github/workflows/release-pypi-build-push-test-package.yml index 19cb51d..3b04b8e 100644 --- a/.github/workflows/release-pypi-build-push-test-package.yml +++ b/.github/workflows/release-pypi-build-push-test-package.yml @@ -10,6 +10,10 @@ on: default: "" required: false +# Read-only GITHUB_TOKEN: the job only checks out and uploads to PyPI with PYPI_TOKEN +permissions: + contents: read + jobs: build_push: runs-on: ubuntu-latest @@ -35,13 +39,16 @@ jobs: poetry install --with=dev - name: bump_test_version + # The input goes through an env var, not ${{ }} in the script, so it can't inject shell code + env: + VERSION: ${{ github.event.inputs.version }} run: | - if [ -z "${{ github.event.inputs.version }}" ]; then + if [ -z "$VERSION" ]; then echo "No version input provided, running without RELEASE_VERSION." make bump-test-version else - echo "Version input provided: ${{ github.event.inputs.version }}" - make bump-test-version RELEASE_VERSION=${{ github.event.inputs.version }} + echo "Version input provided: $VERSION" + make bump-test-version RELEASE_VERSION="$VERSION" fi shell: bash From 79ab638878c1a8289efb971e57555f27d415e048 Mon Sep 17 00:00:00 2001 From: Diego OJ Date: Sun, 15 Nov 2026 16:45:05 -0300 Subject: [PATCH 2/2] Fix | Validate the version input before it reaches make make expands RELEASE_VERSION from the command line, so $(shell ...) in the input would still run. Only 9.9.9-rc9 versions pass now (CodeRabbit review). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-pypi-build-push-test-package.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release-pypi-build-push-test-package.yml b/.github/workflows/release-pypi-build-push-test-package.yml index 3b04b8e..c3661a5 100644 --- a/.github/workflows/release-pypi-build-push-test-package.yml +++ b/.github/workflows/release-pypi-build-push-test-package.yml @@ -48,6 +48,11 @@ jobs: make bump-test-version else echo "Version input provided: $VERSION" + # make expands RELEASE_VERSION too ($(shell ...) would run), so only a well-formed version reaches it + if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$ ]]; then + echo "[ERROR] Invalid format for version input. Expected format: 9.9.9-rc9" >&2 + exit 1 + fi make bump-test-version RELEASE_VERSION="$VERSION" fi shell: bash