airbrake/airbrake-ruby

Support deep keys

grosser opened this issue · 6 comments

rails filter_parameters allows foo.bar meaning foo[bar]
which is not compatible with airbrakes blacklist filter
so please either:

  • support it (might be tricky, but a useful filter)
  • change airbrake rails docs to point this out

Thanks for filing this! I think we already support that on notifier level (if you filter just foo, it'll be filtered everywhere, even in:

{
  not_foo: {
    not_foo_again: {
      foo: 'will be filtered'
    }
  }
}

But in this regard our API is probably indeed incompatible. I guess it's better to document this and ignore bar in foo[bar]. That said, it's possible to filter both, foo and bar (globally, like we do as of now), but it might be risky/unwanted.

doing this atm ... just a evil trap that the docs say 'put filter into blacklist' and then they do not work the same way ... which ends up leaking secrets into airbrake ... not fun :(

Sorry about that. I was simply unaware of the foo.bar syntax. It seems like it's a Rails 5 feature.

would you accept a PR to add this feature ? ... I think it's pretty useful :)

Depends on the implementation. If there's a neat way to implement this, then why not? However our current policy is to filter out every matching key, no matter how deep it is. We also support whitelists. This might make the implementation harder. Without special cases the code for truncation is nice, fast and tidy.

TL;DR Go for it, but it might be harder than you think :P
P.S. But probably not too hard

took a look ... would mean rewriting filtering logic ... and make it a bunch slower ... so not doing it ...