Skip to content

Commit 1198be7

Browse files
Copilotlaeubi
andcommitted
Add validation for currentStreamVersionProperty parameter
Co-authored-by: laeubi <[email protected]>
1 parent 96945ff commit 1198be7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/checkVersions.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,16 @@ jobs:
9494
if [[ $(git diff --name-only --cached) != '' ]]; then
9595
# Relevant files were staged, i.e. some version were changed
9696
97+
# Validate property name to prevent injection
98+
propertyName="${{ inputs.currentStreamVersionProperty }}"
99+
if [[ ! "$propertyName" =~ ^[a-zA-Z0-9._-]+$ ]]; then
100+
echo "::error::Invalid property name: $propertyName. Must contain only alphanumeric characters, dots, hyphens, and underscores."
101+
exit 1
102+
fi
103+
97104
# Read property as stream version
98105
pushd ${{ inputs.working-directory }}
99-
mvn help:evaluate -Dexpression=${{ inputs.currentStreamVersionProperty }} ${{ inputs.extra-maven-args }} --quiet '-Doutput=currentStreamVersion-value.txt'
106+
mvn help:evaluate -Dexpression="$propertyName" ${{ inputs.extra-maven-args }} --quiet '-Doutput=currentStreamVersion-value.txt'
100107
streamVersion=$(<currentStreamVersion-value.txt)
101108
rm -f currentStreamVersion-value.txt
102109
popd

0 commit comments

Comments
 (0)