Be more secure in the use of "read"

This commit is contained in:
Tom Limoncelli
2014-11-05 16:48:10 +00:00
committed by tlimoncelli@stackexchange.com
parent eb96b6d1fc
commit b5c778a08e
3 changed files with 4 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ set -e
for param in """$@""" ; do
unencrypted_file=$(get_unencrypted_filename "$param")
if [[! is_on_cryptlist "$param" ]] && [[! is_on_cryptlist "$unencrypted_file" ]] ; then
read -p "Encrypt file $param? (y/n) " ans
read -r -p "Encrypt file $param? (y/n) " ans
case "$ans" in
y* | Y*)
blackbox_register_new_file "$param"

View File

@@ -14,7 +14,7 @@ set -e
_determine_vcs_base_and_type # Sets VCS_TYPE
if [[ $1 != 'yes' ]]; then
read -p "Enable blackbox for this $VCS_TYPE repo? (yes/no) " ans
read -r -p "Enable blackbox for this $VCS_TYPE repo? (yes/no) " ans
if [[ $ans = 'no' || $ans = 'n' || $ans = '' ]]; then
echo 'Exiting...'
exit 1

View File

@@ -11,7 +11,7 @@ if [[ -z $GPG_AGENT_INFO ]]; then
echo 'WARNING: You probably want to run gpg-agent as'
echo 'you will be asked for your passphrase many times.'
echo 'Example: $ eval $(gpg-agent --daemon)'
read -p 'Press CTRL-C now to stop. ENTER to continue: '
read -r -p 'Press CTRL-C now to stop. ENTER to continue: '
fi
disclose_admins
@@ -33,7 +33,7 @@ done
if $need_warning ; then
echo
echo 'WARNING: This will overwrite any unencrypted files laying about.'
read -p 'Press CTRL-C now to stop. ENTER to continue: '
read -r -p 'Press CTRL-C now to stop. ENTER to continue: '
else
echo 'All OK.'
fi