forked from stripe/stripe-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement deep copy for StripeObject and remove marshal/unmarshal
We were previously using a bit of a hack to get a free deep copy implementation through Ruby's marshaling framework. Lint call this out as a security problem though, and rightfully so: when combined with unsanitized user input, unmarshaling can result in very serious security breaches involving arbitrary code execution. This patch removes all uses of marshal/unmarshal in favor of implementing a deep copy method for `StripeObject`. I also reworked some of the constants around what keys are available for `opts`. I'm still not completely happy with the results, but I think it's going to need a slightly larger refactor in order to get somewhere truly good. There is what could be a breaking change for people doing non-standard stuff with the library: the opts that we copy with an object are now whitelisted, so if they were being used to pass around extraneous data, that might not work as expected anymore. But because this is a contract that we never committed to, I don't think I'd bump the major version for change.
- Loading branch information
Showing
5 changed files
with
116 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters