Skip to content

Commit 45529b2

Browse files
authored
[Infra] Add double quotes around vars in rotate_secrets.sh (#13181)
1 parent 20a4247 commit 45529b2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/rotate_secrets.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ files=$(find "$secrets_directory" -name "*.gpg")
5454
# secret.
5555
for encrypted_file in $files; do
5656
echo "Decrypting $encrypted_file"
57-
scripts_dir=$(dirname $0)
57+
scripts_dir=$(dirname "$0")
5858
# The decrypted file's path will match the encrypted file's path, minus the
5959
# trailing `.gpg` extension.
6060
decrypted_file=${encrypted_file%.*}
6161
source "$scripts_dir/decrypt_gha_secret.sh" \
62-
$encrypted_file $decrypted_file $current_secret_key
62+
"$encrypted_file" "$decrypted_file" "$current_secret_key"
6363
if [ ! -f "$decrypted_file" ]; then
6464
echo "Error: The file could not be decrypted: $encrypted_file"
6565
exit 1
@@ -68,16 +68,16 @@ for encrypted_file in $files; do
6868
# Remove current encrypted file or else re-encryption will fail due to the
6969
# gpg file already existing. The below script invocation will re-encrypt
7070
# the file to the `encrypted_file` path.
71-
rm $encrypted_file
71+
rm "$encrypted_file"
7272

7373
echo "Encrypting with new secret to $encrypted_file"
7474

75-
source "$scripts_dir/encrypt_gha_secret.sh" $decrypted_file $new_secret_key
75+
source "$scripts_dir/encrypt_gha_secret.sh" "$decrypted_file" "$new_secret_key"
7676
if [ ! -f "$encrypted_file" ]; then
7777
echo "Error: The file could not be encrypted: $decrypted_file"
7878
exit 1
7979
fi
8080

8181
# Cleanup the decrpted file now that it's been re-encrypted.
82-
rm $decrypted_file
82+
rm "$decrypted_file"
8383
done

0 commit comments

Comments
 (0)