Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions application/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,26 @@ function get_server_cert() {
fi
}

# Function to remove sensitive values from sentry Event
filter_sensitive_values() {
local msg="$1"
for var in AWS_ACCESS_KEY AWS_SECRET_KEY B2_APPLICATION_KEY B2_APPLICATION_KEY_ID MYSQL_PASSWORD; do
val="${!var}"
if [ -n "$val" ]; then
msg="${msg//$val/[FILTERED]}"
fi
done
echo "$msg"
}

# Sentry reporting with validation and backwards compatibility
error_to_sentry() {
local error_message="$1"
local db_name="$2"
local status_code="$3"

error_message=$(filter_sensitive_values "$error_message")

# Check if SENTRY_DSN is configured - ensures backup continues
if [ -z "${SENTRY_DSN:-}" ]; then
log "DEBUG" "Sentry logging skipped - SENTRY_DSN not configured"
Expand Down
14 changes: 14 additions & 0 deletions application/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,26 @@ function get_server_cert() {
fi
}

# Function to remove sensitive values from sentry Event
filter_sensitive_values() {
local msg="$1"
for var in AWS_ACCESS_KEY AWS_SECRET_KEY B2_APPLICATION_KEY B2_APPLICATION_KEY_ID MYSQL_PASSWORD; do
val="${!var}"
if [ -n "$val" ]; then
msg="${msg//$val/[FILTERED]}"
fi
done
echo "$msg"
}

# Sentry reporting with validation and backwards compatibility
error_to_sentry() {
local error_message="$1"
local db_name="$2"
local status_code="$3"

error_message=$(filter_sensitive_values "$error_message")

# Check if SENTRY_DSN is configured - ensures restore continues
if [ -z "${SENTRY_DSN:-}" ]; then
log "DEBUG" "Sentry logging skipped - SENTRY_DSN not configured"
Expand Down