File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,26 @@ log() {
77 echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] ${level} : ${message} " ;
88}
99
10+ # Function to remove sensitive values from sentry Event
11+ filter_sensitive_values () {
12+ local msg=" $1 "
13+ for var in AWS_ACCESS_KEY AWS_SECRET_KEY B2_APPLICATION_KEY B2_APPLICATION_KEY_ID DB_ROOTPASSWORD DB_USERPASSWORD; do
14+ val=" ${! var} "
15+ if [ -n " $val " ]; then
16+ msg=" ${msg// $val / [FILTERED]} "
17+ fi
18+ done
19+ echo " $msg "
20+ }
21+
1022# Sentry reporting with validation and backwards compatibility
1123error_to_sentry () {
1224 local error_message=" $1 " ;
1325 local db_name=" $2 " ;
1426 local status_code=" $3 " ;
1527
28+ error_message=$( filter_sensitive_values " $error_message " )
29+
1630 # Check if SENTRY_DSN is configured - ensures backup continues
1731 if [ -z " ${SENTRY_DSN:- } " ]; then
1832 log " DEBUG" " Sentry logging skipped - SENTRY_DSN not configured" ;
Original file line number Diff line number Diff line change @@ -7,12 +7,25 @@ log() {
77 echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] ${level} : ${message} "
88}
99
10+ filter_sensitive_values () {
11+ local msg=" $1 "
12+ for var in AWS_ACCESS_KEY AWS_SECRET_KEY B2_APPLICATION_KEY B2_APPLICATION_KEY_ID DB_ROOTPASSWORD DB_USERPASSWORD; do
13+ val=" ${! var} "
14+ if [ -n " $val " ]; then
15+ msg=" ${msg// $val / [FILTERED]} "
16+ fi
17+ done
18+ echo " $msg "
19+ }
20+
1021# Sentry reporting with validation and backwards compatibility
1122error_to_sentry () {
1223 local error_message=" $1 "
1324 local db_name=" $2 "
1425 local status_code=" $3 "
1526
27+ error_message=$( filter_sensitive_values " $error_message " )
28+
1629 # Check if SENTRY_DSN is configured - ensures restore continues
1730 if [ -z " ${SENTRY_DSN:- } " ]; then
1831 log " DEBUG" " Sentry logging skipped - SENTRY_DSN not configured"
You can’t perform that action at this time.
0 commit comments