Skip to content

Commit 88e50a1

Browse files
committed
fix: harden release-trigger against shell injection and fix stale docs
- Pass workflow_dispatch version input via env: instead of direct interpolation into shell script, preventing potential injection attacks - Validate version input against strict semver regex before use - Fix RELEASE-PROCESS.md Option 2 still referencing [Unreleased] section handling that no longer exists in the workflow
1 parent cc2754c commit 88e50a1

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/RELEASE-PROCESS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ The workflow will:
7474
The workflow will:
7575
- Use your specified version
7676
- Update `pyproject.toml`
77-
- Convert `[Unreleased]` section in CHANGELOG.md to the new version
78-
- Add a new empty `[Unreleased]` section
77+
- Update `CHANGELOG.md` by adding a new section for the release based on commits since the last tag
7978
- Commit changes
8079
- Create and push git tag
8180
- Trigger the release workflow automatically

.github/workflows/release-trigger.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ jobs:
2727
2828
- name: Determine version
2929
id: version
30+
env:
31+
INPUT_VERSION: ${{ github.event.inputs.version }}
3032
run: |
31-
if [[ -n "${{ github.event.inputs.version }}" ]]; then
32-
# Manual version specified
33-
VERSION="${{ github.event.inputs.version }}"
34-
# Remove 'v' prefix if present
35-
VERSION=${VERSION#v}
33+
if [[ -n "$INPUT_VERSION" ]]; then
34+
# Manual version specified - strip optional v prefix
35+
VERSION="${INPUT_VERSION#v}"
36+
# Validate strict semver format to prevent injection
37+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
38+
echo "Error: Invalid version format '$VERSION'. Must be X.Y.Z (e.g. 1.2.3 or v1.2.3)"
39+
exit 1
40+
fi
3641
echo "version=$VERSION" >> $GITHUB_OUTPUT
3742
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
3843
echo "Using manual version: $VERSION"

0 commit comments

Comments
 (0)