File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,26 @@ function get_server_cert() {
4141 fi
4242}
4343
44+ # Function to remove sensitive values from sentry Event
45+ filter_sensitive_values () {
46+ local msg=" $1 "
47+ for var in AWS_ACCESS_KEY AWS_SECRET_KEY B2_APPLICATION_KEY B2_APPLICATION_KEY_ID MYSQL_PASSWORD; do
48+ val=" ${! var} "
49+ if [ -n " $val " ]; then
50+ msg=" ${msg// $val / [FILTERED]} "
51+ fi
52+ done
53+ echo " $msg "
54+ }
55+
4456# Sentry reporting with validation and backwards compatibility
4557error_to_sentry () {
4658 local error_message=" $1 "
4759 local db_name=" $2 "
4860 local status_code=" $3 "
4961
62+ error_message=$( filter_sensitive_values " $error_message " )
63+
5064 # Check if SENTRY_DSN is configured - ensures backup continues
5165 if [ -z " ${SENTRY_DSN:- } " ]; then
5266 log " DEBUG" " Sentry logging skipped - SENTRY_DSN not configured"
Original file line number Diff line number Diff line change @@ -16,12 +16,26 @@ function get_server_cert() {
1616 fi
1717}
1818
19+ # Function to remove sensitive values from sentry Event
20+ filter_sensitive_values () {
21+ local msg=" $1 "
22+ for var in AWS_ACCESS_KEY AWS_SECRET_KEY B2_APPLICATION_KEY B2_APPLICATION_KEY_ID MYSQL_PASSWORD; do
23+ val=" ${! var} "
24+ if [ -n " $val " ]; then
25+ msg=" ${msg// $val / [FILTERED]} "
26+ fi
27+ done
28+ echo " $msg "
29+ }
30+
1931# Sentry reporting with validation and backwards compatibility
2032error_to_sentry () {
2133 local error_message=" $1 "
2234 local db_name=" $2 "
2335 local status_code=" $3 "
2436
37+ error_message=$( filter_sensitive_values " $error_message " )
38+
2539 # Check if SENTRY_DSN is configured - ensures restore continues
2640 if [ -z " ${SENTRY_DSN:- } " ]; then
2741 log " DEBUG" " Sentry logging skipped - SENTRY_DSN not configured"
You can’t perform that action at this time.
0 commit comments