sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

LogEvent does not correctly handle nested attributes (e.g., Rails ActionController params)

Open vivekmiyani opened this issue 1 month ago • 3 comments

Issue Description

Sentry::LogEvent does not correctly handle nested attributes (such as Rails ActionController's params)

Reproduction Steps

  • Clone repo https://github.com/vivekmiyani/bookmarks.git

  • Run rails server

    SENTRY_DSN=REPLACE_ME rails s
    
  • Trigger endpoint

    curl -X POST http://localhost:3000/bookmarks.json -H "Content-Type: application/json" -d '{"bookmark":{"title":"Hello world","url":"Hello world"}}'
    
  • Notice that it doesn't show params passed in logs sentry page

Expected Behavior

Actual Behavior

  • Passed params is not present

Ruby Version

3.4.5

SDK Version

6.2.0

Integration and Its Version

Rails

Sentry Config

Sentry config

vivekmiyani avatar Nov 27 '25 22:11 vivekmiyani

RUBY-121

linear[bot] avatar Nov 27 '25 22:11 linear[bot]

@solnic, I checked other SDKs, and they seem to handle this correctly:

So I implemented a similar solution for Ruby in my fork: https://github.com/getsentry/sentry-ruby/compare/master...vivekmiyani:sentry-ruby:master?expand=1

A couple of questions before raising a PR:

  • Is it okay to use JSON.generate here?
  • Or should we use #inspect (similar to Python's repr) instead?

Happy to raise PR once you approve the issue :)

vivekmiyani avatar Nov 27 '25 22:11 vivekmiyani

@vivekmiyani thank you for reporting the issue and offering help ❤️ Please feel free to open a PR and using JSON like you mentioned. The subscriber is using params filtering by default already so it should be safe.

solnic avatar Nov 28 '25 11:11 solnic