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() {
7
7
echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] ${level} : ${message} " ;
8
8
}
9
9
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
+
10
22
# Sentry reporting with validation and backwards compatibility
11
23
error_to_sentry () {
12
24
local error_message=" $1 " ;
13
25
local db_name=" $2 " ;
14
26
local status_code=" $3 " ;
15
27
28
+ error_message=$( filter_sensitive_values " $error_message " )
29
+
16
30
# Check if SENTRY_DSN is configured - ensures backup continues
17
31
if [ -z " ${SENTRY_DSN:- } " ]; then
18
32
log " DEBUG" " Sentry logging skipped - SENTRY_DSN not configured" ;
Original file line number Diff line number Diff line change @@ -7,12 +7,25 @@ log() {
7
7
echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] ${level} : ${message} "
8
8
}
9
9
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
+
10
21
# Sentry reporting with validation and backwards compatibility
11
22
error_to_sentry () {
12
23
local error_message=" $1 "
13
24
local db_name=" $2 "
14
25
local status_code=" $3 "
15
26
27
+ error_message=$( filter_sensitive_values " $error_message " )
28
+
16
29
# Check if SENTRY_DSN is configured - ensures restore continues
17
30
if [ -z " ${SENTRY_DSN:- } " ]; then
18
31
log " DEBUG" " Sentry logging skipped - SENTRY_DSN not configured"
You can’t perform that action at this time.
0 commit comments