Skip to content

Commit ed018b2

Browse files
committed
Prevent script injection from input
1 parent 064470c commit ed018b2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/publish_nuget.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ jobs:
3232
runs-on: ubuntu-latest
3333

3434
steps:
35+
# validate the input.version as Github do not yet support regex validation
36+
- name: Validate version input
37+
run: |
38+
REGEXP="^[1-9]{1,2}.[0-9]+.[0-9]+(-beta\d+)?$"
39+
if [[ ! "$UNTRUSTED_INPUT" =~ $REGEXP ]]; then
40+
echo "::error:: Invalid version format"
41+
exit 1
42+
fi
43+
env:
44+
UNTRUSTED_INPUT: ${{ github.event.inputs.version }}
45+
3546
- uses: actions/checkout@v6
3647

3748
# Only validate tag is on master for auto-triggered runs

0 commit comments

Comments
 (0)