Issue #20396 has been updated by shyouhei (Shyouhei Urabe).
I'm not sure if I'm in favor of this request then. ObjectSpace.dump_all is very
much analogous to a coredump. Both are very handy on occasions. I don't doubt your
experience of finding memory leak is real. But... People normally don't try to cruft
a coredump. One do often include sensitive info, but being able to access to a coredump
is a big threat already. We normally strictly restrict access to them. The same thing
can go for ObjectSpace.dump_all output.
I wrote "I prefer simple API for ObjectSpace.dump_all" because, I'm pretty
sure this is not the last thing you wanted for the output. People need to filter out some
objects fields, order by something, group by something, having a histogram, ... and pretty
sure we would end up need an entire SQL engine. My preference is this method should
remain as simple as possible, and let `jq(1)` etc., having that business.
----------------------------------------
Feature #20396: ObjectSpace.dump_all(string_value: false): skip dumping the String
contents
https://bugs.ruby-lang.org/issues/20396#change-107982
* Author: byroot (Jean Boussier)
* Status: Open
----------------------------------------
`ObjectSpace.dump_all` is a very useful method to debug memory leaks and such, hence is
frequently needed in production. But since all the 7bit strings content is included in the
dump, it incur the risk of leaking personal data, or secrets.
Also, in many case the strings content isn't that helpful and is just making the dump
much bigger for no good reason. And only pure-ASCII strings are dumped this way, which
means all the tools that process these dumps should already be compatible with a dump
without any string content.
### Feature
I propose to add another optional parameter to `dump_all`: `string_value: false`. When
passed, no String content is ever dumped regardless of its coderange.
Implementation:
https://github.com/ruby/ruby/pull/10382
cc @zzak
--
https://bugs.ruby-lang.org/