1010#
1111# Usage: ./aws-end-user-messaging-gs.sh [--auto-cleanup]
1212
13- set -euo pipefail
13+ set -uo pipefail
1414
1515# Security: Set secure umask for created files
1616umask 0077
1717
18- # Set up logging with secure file permissions
19- LOG_DIR=" ${XDG_STATE_HOME :- .} /aws-eump-logs"
18+ # Set up logging
19+ LOG_DIR=" . /aws-eump-logs"
2020mkdir -p " $LOG_DIR "
21- chmod 700 " $LOG_DIR "
22-
2321LOG_FILE=" $LOG_DIR /aws-end-user-messaging-push-script-$( date +%Y%m%d-%H%M%S) .log"
2422exec > >( tee -a " $LOG_FILE " ) 2>&1
25- chmod 600 " $LOG_FILE "
2623
2724echo " Starting AWS End User Messaging Push setup script..."
2825echo " Logging to $LOG_FILE "
@@ -38,7 +35,7 @@ cleanup() {
3835 echo " Cleaning up temporary resources..."
3936
4037 # Remove temporary files securely
41- for temp_file in " ${TEMP_FILES[@]} " ; do
38+ for temp_file in " ${TEMP_FILES[@]+ " ${TEMP_FILES[@]} " } " ; do
4239 if [ -f " $temp_file " ]; then
4340 shred -vfz -n 3 " $temp_file " 2> /dev/null || rm -f " $temp_file "
4441 fi
@@ -142,7 +139,7 @@ validate_permissions() {
142139 echo " Validating IAM permissions..."
143140
144141 # Test basic Pinpoint permissions
145- if ! aws pinpoint get-apps & > /dev/null; then
142+ if ! aws pinpoint get-apps > /dev/null 2>&1 ; then
146143 echo " WARNING: Unable to list Pinpoint applications." >&2
147144 echo " Please ensure you have appropriate IAM permissions for Pinpoint operations." >&2
148145 echo " Required permissions:" >&2
0 commit comments