eu-nebulous / gui

Mozilla Public License 2.0
0 stars 0 forks source link

Scape characters from env variables values #3

Closed robert-sanfeliu closed 4 months ago

robert-sanfeliu commented 4 months ago

Characters ' " in environmental variables should be escaped in the value should be escaped. If not, generated code for master/worker install script is incorrect and fails during execution.

Consider this request to define cluster:

.....
"env-var": {
        "AN_ENV_VARIABLE": "avalue",
    }

This will lead to the following script being generated and successfully executed:

# Environment variables preparation
echo "Exporting env vars ..."
source ./envVars.sh
echo "Done."

# Separation script

echo 'export AN_ENV_VARIABLE="avalue"' >> /home/ubuntu/.profile
source /home/ubuntu/.profile

Now consider this request to define cluster:

.....
"env-var": {
        "AN_ENV_VARIABLE": "av'alue",
    }

This will lead to the following script being generated:

# Environment variables preparation
echo "Exporting env vars ..."
source ./envVars.sh
echo "Done."

# Separation script

echo 'export AN_ENV_VARIABLE="av'alue"' >> /home/ubuntu/.profile
source /home/ubuntu/.profile

This script won't execute properly.

robert-sanfeliu commented 4 months ago

Moving issue to https://github.com/eu-nebulous/sal/issues/5