Tutorial for the new Sandbox class.
I wrote a short tutorial I'd like to share with everybody about the new Sandbox class introduced in the new 0.7 release of MacRuby. I tried to focus on using the class inside MacRuby as much as possible. Please let me know what you think, spot errors, etc! Link: http://robgleeson.github.com/documents/macruby-sandbox-class/ … Rob
Hi Rob, It looks nice! Thanks for writing it :) Something worth mentioning I believe is that sandbox profiles are actually Scheme expressions, and that the default Sandbox class constructor allows you to pass such an expression, as a string. If you look at the /usr/share/sandbox/ directory on your system, you will see custom profiles. However, it's important to note that custom Scheme profiles are considered as private API and might not be supported across OS releases. Laurent On Oct 6, 2010, at 12:59 AM, Rob Gleeson wrote:
I wrote a short tutorial I'd like to share with everybody about the new Sandbox class introduced in the new 0.7 release of MacRuby. I tried to focus on using the class inside MacRuby as much as possible.
Please let me know what you think, spot errors, etc!
Link: http://robgleeson.github.com/documents/macruby-sandbox-class/
… Rob
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On 6 Oct 2010, at 09:19, Laurent Sansonetti wrote:
It looks nice! Thanks for writing it :)
No problem! My way of contributing back to the MacRuby community, since I'm not that good with C/ObjC.
Something worth mentioning I believe is that sandbox profiles are actually Scheme expressions, and that the default Sandbox class constructor allows you to pass such an expression, as a string.
If you look at the /usr/share/sandbox/ directory on your system, you will see custom profiles.
However, it's important to note that custom Scheme profiles are considered as private API and might not be supported across OS releases
Thanks for the info! I had no idea they were written in Scheme, or that OSX came with custom profiles. I updated the tutorial with your information included: http://robgleeson.github.com/documents/macruby-sandbox-class/ Is it more correct now? Sad to say, I'm not a great writer. Thanks for reading it! Rob
On Oct 6, 2010, at 3:07 AM, Rob Gleeson wrote:
On 6 Oct 2010, at 09:19, Laurent Sansonetti wrote:
It looks nice! Thanks for writing it :)
No problem! My way of contributing back to the MacRuby community, since I'm not that good with C/ObjC.
Something worth mentioning I believe is that sandbox profiles are actually Scheme expressions, and that the default Sandbox class constructor allows you to pass such an expression, as a string.
If you look at the /usr/share/sandbox/ directory on your system, you will see custom profiles.
However, it's important to note that custom Scheme profiles are considered as private API and might not be supported across OS releases
Thanks for the info! I had no idea they were written in Scheme, or that OSX came with custom profiles. I updated the tutorial with your information included: http://robgleeson.github.com/documents/macruby-sandbox-class/
Is it more correct now? Sad to say, I'm not a great writer. Thanks for reading it!
It looks good to me (but I'm not a native English speaker :)). I think this tutorial should be on the website. Would you mind converting it? If yes, some information is available here: http://www.macruby.org/documentation/website-contributions.html Laurent
It looks good to me (but I'm not a native English speaker :)).
I think this tutorial should be on the website. Would you mind converting it? If yes, some information is available here: http://www.macruby.org/documentation/website-contributions.html
Laurent
Done! :-) Commit : http://github.com/robgleeson/macruby_website/commit/f2551217962a938a83f1063a... File : http://github.com/robgleeson/macruby_website/blob/Sandbox_class_tutorial/con... Rob
Thx I'll merge the article asap (after a quick sanity check). - Matt Sent from my iPhone On Oct 7, 2010, at 1:17, Rob Gleeson <rob@flowof.info> wrote:
It looks good to me (but I'm not a native English speaker :)).
I think this tutorial should be on the website. Would you mind converting it? If yes, some information is available here: http://www.macruby.org/documentation/website-contributions.html
Laurent
Done! :-)
Commit : http://github.com/robgleeson/macruby_website/commit/f2551217962a938a83f1063a... File : http://github.com/robgleeson/macruby_website/blob/Sandbox_class_tutorial/con...
Rob
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hi Rob, I like the tutorial, it's nicely short and concise. One thing I'd like to see is the expected outcome of running the code you've placed within the text. Could you include this information underneath the code blocks? I'm imagining that most people would try this out using the interactive prompt (and you can maybe mention that as an exercise for the reader), so it's a nice little hint to go and play around with the files in /usr/share/sandbox/ I've always found that having an interactive console is one of the most encouraging things about Ruby, so it's always nice to promote its use, especially when learning. Nick On 6 Oct 2010, at 08:59, Rob Gleeson wrote:
I wrote a short tutorial I'd like to share with everybody about the new Sandbox class introduced in the new 0.7 release of MacRuby. I tried to focus on using the class inside MacRuby as much as possible.
Please let me know what you think, spot errors, etc!
Link: http://robgleeson.github.com/documents/macruby-sandbox-class/
… Rob
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On 7 Oct 2010, at 10:49, Nick Ludlam wrote:
Hi Rob, I like the tutorial, it's nicely short and concise. One thing I'd like to see is the expected outcome of running the code you've placed within the text. Could you include this information underneath the code blocks?
I'm imagining that most people would try this out using the interactive prompt (and you can maybe mention that as an exercise for the reader), so it's a nice little hint to go and play around with the files in /usr/share/sandbox/
I've always found that having an interactive console is one of the most encouraging things about Ruby, so it's always nice to promote its use, especially when learning.
Nick
Hm, those are good points. I also failed to mention that Sandbox#apply! will raise a SecurityError if sandbox_init fails. I think I should mention that, too. Matt, could you hold off until tonight or tomorrow so I can make those changes? Thanks, Rob
Okay, I modified the document a tiny bit making note of the return value of #apply!, and the SecurityError exception it can raise: http://github.com/robgleeson/macruby_website/blob/Sandbox_class_tutorial/con...
Thanks Rob, I didn't forget you, but I'm on a business trip and I don't have the macruby repo setup on this machine so I'll merge your changes over the week end. - Matt On Thu, Oct 7, 2010 at 7:25 AM, Rob Gleeson <rob@flowof.info> wrote:
Okay, I modified the document a tiny bit making note of the return value of #apply!, and the SecurityError exception it can raise: http://github.com/robgleeson/macruby_website/blob/Sandbox_class_tutorial/con... _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On 8 Oct 2010, at 23:27, Matt Aimonetti wrote:
Thanks Rob, I didn't forget you, but I'm on a business trip and I don't have the macruby repo setup on this machine so I'll merge your changes over the week end.
- Matt
No worries. I spotted some errors in the tutorial, I mapped Sandbox.no_writes and Sandbox.no_network incorrectly in the tutorial.. I've sent you a message on GitHub with a link to the commit that fixes those issues. Really sorry about that, Rob.
No worries, I merged everything into our svn repo and it will go in our next website deployment. - Matt On Sat, Oct 9, 2010 at 2:35 PM, Rob Gleeson <rob@flowof.info> wrote:
On 8 Oct 2010, at 23:27, Matt Aimonetti wrote:
Thanks Rob, I didn't forget you, but I'm on a business trip and I don't have the macruby repo setup on this machine so I'll merge your changes over the week end.
- Matt
No worries.
I spotted some errors in the tutorial, I mapped Sandbox.no_writes and Sandbox.no_network incorrectly in the tutorial.. I've sent you a message on GitHub with a link to the commit that fixes those issues.
Really sorry about that, Rob. _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (4)
-
Laurent Sansonetti
-
Matt Aimonetti
-
Nick Ludlam
-
Rob Gleeson