Should for whatever reason $BUILD_DIR expand to ... / ..., then this runs sudo rm -rf /, as rm just ignores missing directories/files it is supplied with and operates on each argument, i.e. file/directory.
Given that BUILD_DIR is constructed from the path of the script location, it becomes interesting the moment the user unpacks the archive into a path that contains a space or some other fun characters.
It would create the plugins directory in all the locations $AGENT_DIR would be split into, because it is not quoted. Since -p is used, it will not even fail if the parent directory does not yet exist and create it as well.
For the time being I won't be running these scripts on anything other than a fresh virtual machine that isn't used for anything else.
Sadly I don't have the time to fix it all as I'm quite busy at the moment.
All unquoted variables in the .sh scripts are subject to Word Splitting, Pathname Expansion, etc. by bash, making these statements very risky:
Should for whatever reason
$BUILD_DIR
expand to... / ...
, then this runssudo rm -rf /
, asrm
just ignores missing directories/files it is supplied with and operates on each argument, i.e. file/directory.Given that
BUILD_DIR
is constructed from the path of the script location, it becomes interesting the moment the user unpacks the archive into a path that contains a space or some other fun characters.What it should look like is this:
Reading material:
Here is another one:
Also fun:
It would create the plugins directory in all the locations
$AGENT_DIR
would be split into, because it is not quoted. Since-p
is used, it will not even fail if the parent directory does not yet exist and create it as well.For the time being I won't be running these scripts on anything other than a fresh virtual machine that isn't used for anything else.
Sadly I don't have the time to fix it all as I'm quite busy at the moment.