-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I load this without monkey patching? #47
Comments
Honest question: how do you plan on using this in a library? Originally, my intention was for safe_yaml to be useful to application developers. The monkey patching--which mastahyeti introduced way back in the first pull request, and I've stuck with--makes it very useful in this context: all you do is add a dependency on safe_yaml, and automatically your application is safer wherever your code or any code calls My guess is that you have a library and you want it to deserialize YAML somewhere, and you want to use
The third is the most work, but I kinda think it's the best approach. Of course there could be a fourth option I'm not thinking of. |
I wrote a library for parsing TAP. TAP can contain YAML and is in most cases untrusted input. I would like to be able to require something in my library so that I can load YAML safely but don't mess with the YAML.load method for anything else. That is, if safe_yaml has been loaded by the app using my library, it should still be safe, otherwise it should still be able to load any unsafe objects. Therefore option 2 would not work. I would also prefer 3. It doesn't need to be a separate gem, it could also be that I load |
Ha, that's a good point. Pretty ridiculous that I didn't even think of that. It should be pretty easy to extract the |
This is so you can require safe_yaml/load without monkey-patching the YAML module if you want.
OK, I've pushed a change that I think should address your needs. Try updating your gem spec to temporarily pull from HEAD and use |
I'm the same boat, using this for a library. Would love to push a release with this addition. Would a confirmation of the behavior help a release of safe_yaml? Thanks @dtao! |
@fnichol Sorry for the delayed response. Yeah, if you have tried out the |
No problem, I'll attempt to give it a spin today or tomorrow to confirm. Thanks! |
OK I'm closing this since |
@dtao This is great and has been doing the trick for me, thank you! |
Add language for slide/movie
This is currently unusable for libraries. :(
The text was updated successfully, but these errors were encountered: