I tried using `Marshal` but it doesn't work because of the lambdas in the default whitelist.

So it sounds like your suggestion is to use `Hash[]` rather than `.dup`, but otherwise leave this as-is?