Codebuild was failing when trying to set an env var with newlines.
This is a script that demonstrates the problem:
set -e;
export dev_TEST="VALUE WITH TABS\nAND NEWLINE"
for var in "${!dev_@}"; do
export ${var#dev_}=${!var}
done
echo $TEST
Running it yelds the error:
test.sh: line 6: export: `TABS\nAND': not a valid identifier
The fix is to make sure we use quotes when assigning the value of the new env var in line 6:
set -e;
export dev_TEST="VALUE WITH TABS\nAND NEWLINE"
for var in "${!dev_@}"; do
export ${var#dev_}="${!var}"
done
echo $TEST
Security Checklist
[ ] Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.
Acceptance Criteria
Codebuild was failing when trying to set an env var with newlines.
This is a script that demonstrates the problem:
Running it yelds the error:
The fix is to make sure we use quotes when assigning the value of the new env var in line 6:
Security Checklist