Skip to content

Commit

Permalink
Add buildparam validation
Browse files Browse the repository at this point in the history
to minimize risk to OBS operations.

The pattern for jobs deliberately does not have a * or +
to not allow DoS or integer overflows.
  • Loading branch information
bmwiedemann committed Nov 18, 2024
1 parent 7427946 commit 0317136
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,15 @@ done
}
buildparams=()
if [ -e _buildparams ] ; then
local n=0
while read ARG ; do
let n++
if ! [[ $ARG =~ ^--jobs=[1-9]$ ]] &&
! [[ $ARG =~ ^--vm-custom-opt=-cpu\ [a-zA-Z0-9=,_+-]+$ ]]
then
echo "buildparams line $n did not match whitelist in $BASH_SOURCE => skipping"
continue
fi
buildparams+=("$ARG")
done < _buildparams
fi
Expand Down

0 comments on commit 0317136

Please sign in to comment.