Comment 3 for bug 1835114

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

In ec2-instance-connect/eic_harvest_hostkeys line 21:
elif [ $(cat /sys/hypervisor/uuid | cut -c1-3) != "ec2" ] ; then
       ^-- SC2046: Quote this to prevent word splitting.
             ^-- SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

In ec2-instance-connect/eic_harvest_hostkeys line 35:
    printf "$2" | openssl dgst -binary -hex -sha256 -mac HMAC -macopt hexkey:$1 | sed 's/.* //'
           ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".
                                                                             ^-- SC2086: Double quote to prevent globbing and word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 41:
    local base=$(echo -n "AWS4${1}" | od -A n -t x1 | sed ':a;N;$!ba;s/[\n ]//g')
          ^-- SC2155: Declare and assign separately to avoid masking return values.

In ec2-instance-connect/eic_harvest_hostkeys line 42:
    local kdate=$(sign "${base}" $2)
          ^-- SC2155: Declare and assign separately to avoid masking return values.
                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 43:
    local kregion=$(sign "${kdate}" $3)
          ^-- SC2155: Declare and assign separately to avoid masking return values.
                                    ^-- SC2086: Double quote to prevent globbing and word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 44:
    local kservice=$(sign "${kregion}" $4)
          ^-- SC2155: Declare and assign separately to avoid masking return values.
                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 51:
if [ $(eval "${curl_cmd} -o /dev/null -I -w %{http_code} http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance/") -ne 200 ]
     ^-- SC2046: Quote this to prevent word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 60:
        key=$(cat $file | awk '{$1=$1};1')
                  ^-- SC2086: Double quote to prevent globbing and word splitting.
                  ^-- SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

In ec2-instance-connect/eic_harvest_hostkeys line 61:
        keys="${keys:+${keys},}\"${key}\""
                               ^-- SC2089: Quotes/backslashes will be treated literally. Use an array.

In ec2-instance-connect/eic_harvest_hostkeys line 66:
trap "rm -rf '${userpath}'" EXIT
              ^-- SC2064: Use single quotes, otherwise this expands now rather than when signalled.

In ec2-instance-connect/eic_harvest_hostkeys line 69:
chmod 700 $userpath
          ^-- SC2086: Double quote to prevent globbing and word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 73:
if [ $? -ne 0 ]
     ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

In ec2-instance-connect/eic_harvest_hostkeys line 86:
if [ $? -ne 0 ]
     ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

In ec2-instance-connect/eic_harvest_hostkeys line 107:
hostkeys=$(echo ${keys:?})
         ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
                ^-- SC2090: Quotes/backslashes in this variable will not be respected.
                ^-- SC2086: Double quote to prevent globbing and word splitting.

In ec2-instance-connect/eic_harvest_hostkeys line 118:
if [ $? -ne 0 ] ; then
     ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.