You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the @send_default_pii flag is set to true, the ip_address set via Sentry.set_user is being overwritten by the IP address calculated from the Rack environment (calculate_real_ip_from_rack). This behavior is not intended and leads to incorrect IP address information being sent to Sentry.
After attempting to disable the send_default_pii flag, the ip_address set via Sentry.set_user was correctly reflected in Sentry. This confirms that the issue is related to the send_default_pii flag causing the IP address to be overwritten by calculate_real_ip_from_rack.
The ip_address set via Sentry.set_user using request.remote_ip should be correctly recorded and not overwritten by calculate_real_ip_from_rack.
Actual Behavior
When @send_default_pii is true, the ip_address set via Sentry.set_user is overwritten by the IP address calculated from calculate_real_ip_from_rack. This results in Cloudflare’s IP address being recorded in Sentry instead of the actual client’s IP address. This discrepancy may arises because the cloudflare-rails gem modifies the IP addresses to Cloudflare’s proxies without change trusted proxies.
Issue Description
When the
@send_default_pii
flag is set to true, theip_address
set viaSentry.set_user
is being overwritten by the IP address calculated from the Rack environment (calculate_real_ip_from_rack
). This behavior is not intended and leads to incorrect IP address information being sent to Sentry.After attempting to disable the send_default_pii flag, the ip_address set via Sentry.set_user was correctly reflected in Sentry. This confirms that the issue is related to the send_default_pii flag causing the IP address to be overwritten by
calculate_real_ip_from_rack
.sentry-ruby/sentry-ruby/lib/sentry/event.rb
Lines 103 to 115 in 36866c5
Reproduction Steps
Expected Behavior
The ip_address set via Sentry.set_user using request.remote_ip should be correctly recorded and not overwritten by
calculate_real_ip_from_rack
.Actual Behavior
When @send_default_pii is true, the ip_address set via Sentry.set_user is overwritten by the IP address calculated from
calculate_real_ip_from_rack
. This results in Cloudflare’s IP address being recorded in Sentry instead of the actual client’s IP address. This discrepancy may arises because the cloudflare-rails gem modifies the IP addresses to Cloudflare’s proxies without change trusted proxies.Ruby Version
3.2.2
SDK Version
5.18.1
Integration and Its Version
No response
Sentry Config
The text was updated successfully, but these errors were encountered: