-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Currently, the command-handling logic is not placed inside a function, making the usage of local environment variables impossible. This can cause previously set environment variables to get overwritten.
To mitigate the above issue, environmental variables get cleared before usage or directly overwritten. However, in some cases environment variables get appended, but not checked if they are empty before. This can cause external code to change the environmental variable at a specific time, causing injection of unwanted codes into the options of mscs/msctl. This can have multiple effects ranging from a confusing and bloated output of status
to a spam of created folders when using start
; however, as far as I have seen, there are no security implications, since variables are always enclosed in double quotes and thus not interpreted.
An example of the above:
Lines 3053 to 3058 in 8118d10
status | show | status-json | show-json) | |
# Figure out which worlds to show the status for. | |
if [ "$#" -ge 1 ]; then | |
for arg in "$@"; do | |
if isWorldAvailable "$arg"; then | |
WORLDS="$WORLDS $arg" |
An example where it's done correctly (note L2668):
Lines 2667 to 2676 in 8118d10
elif [ "$#" -ge 1 ]; then | |
WORLDS='' | |
for arg in "$@"; do | |
if isWorldEnabled "$arg"; then | |
if serverRunning "$arg"; then | |
printf "Unable to start the requested worlds: world '$arg' already running.\n" | |
exit 1 | |
else | |
WORLDS="$WORLDS $arg" | |
fi |