News for hackers. Stuff that matters.
Re:Pastebin, compiler, and debugger supporting 40+ languages by hugs on Thursday July 29, 2010 @04:43PM (#1559190)
Obligatory cross-link to codepad: http://codepad.org/

Footnote to history: I liked codepad so much when I first saw it on HN back in 2008, I tracked down the guy who made it (Steve Hazel/sah) and made him my co-founder! :-)

Re:Pastebin, compiler, and debugger supporting 40+ languages by mahmud on Thursday July 29, 2010 @09:29PM (#1559979)
You made Selenium, you're not too shabby yourself.

How does it feel to be the author of a goddamn resume requirement? :-P

http://jobsearch.monster.com/PowerSearch.aspx?q=selenium

Re:Pastebin, compiler, and debugger supporting 40+ languages by hugs on Thursday July 29, 2010 @11:05PM (#1560143)
:-) I'll celebrate when these two lines cross: http://www.indeed.com/jobtrends?q=qtp,+selenium

Until then, we've got work to do!

Re:Pastebin, compiler, and debugger supporting 40+ languages by patio11 on Friday July 30, 2010 @09:08AM (#1560968)
How does it feel to be the author of a goddamn resume requirement?

Now there's one for the bucket list...

Re:Pastebin, compiler, and debugger supporting 40+ languages by friend_of_all on Friday July 30, 2010 @03:52AM (#1560523)
ideone is better than codepad, but I like both of them
Re:Pastebin, compiler, and debugger supporting 40+ languages by jmhobbs on Thursday July 29, 2010 @03:57PM (#1559020)
Guess they thought of that...

http://ideone.com/Xm7TK

Re:Pastebin, compiler, and debugger supporting 40+ languages by kranner on Friday July 30, 2010 @12:50AM (#1560299)
Maybe they're running the untrusted user-submitted code as processes under the 'nobody' user as a security measure.

I've built something similar for my upcoming programmer-testing service at http://codeboff.in and this is one of the precautions I've taken in my own sandboxing arrangement.

Re:Pastebin, compiler, and debugger supporting 40+ languages by ay on Tuesday August 03, 2010 @08:22PM (#1573247)
And no setuid executables either, at least not in the path.

http://ideone.com/lQbpi

Re:Pastebin, compiler, and debugger supporting 40+ languages by limmeau on Friday July 30, 2010 @03:18AM (#1560479)
They also guard their compilation environment (I think)

http://ideone.com/icJVj

Re:Pastebin, compiler, and debugger supporting 40+ languages by kranner on Friday July 30, 2010 @10:40AM (#1561234)
How is that paste an example of the compiler being guarded?

In fact it looks like '/etc/passwd' is readable to the compiler after all.

Re:Pastebin, compiler, and debugger supporting 40+ languages by limmeau on Friday July 30, 2010 @02:39PM (#1562114)
The Python example in parent printed an /etc/passwd full of nobody-accounts. From my error message, I only know that the first line in the compilation environment is a nobody-account. In all /etc/passwds I remember having dealt with (mostly the distribution-maintained ones of Linux distributions), the first line was the root account. This is by no means a proof that the compilation environment is guarded, but a strong hint.
Re:Pastebin, compiler, and debugger supporting 40+ languages by kranner on Friday July 30, 2010 @06:48PM (#1562847)
OK, but I wonder if it's not easier to just block access to /etc/passwd from the compiler while it is compiling user-submitted code. AppArmor or SELinux could be used to do this.

A decoy /etc/passwd is a bit less plausible to me.

Re:Pastebin, compiler, and debugger supporting 40+ languages by limmeau on Saturday July 31, 2010 @04:40AM (#1563439)
As for the plausibility of the decoy, how do you interpret the output of the Python interpreter in the great-grandparent comment?

If I had to build a compile-and-run sandbox, I'd also look into SELinux or AppArmor. However, blocking reads to /etc/passwd will disable getpwent(), which innocent programs may occasionally use, and with shadow passwords, /etc/passwd should not be sensitive anyway.

Re:Pastebin, compiler, and debugger supporting 40+ languages by kranner on Saturday July 31, 2010 @06:05AM (#1563512)
Hmm, I have to admit a 'nobody' account with UID and GID 0 is weird. I'm not sure if it is possible for a non-superuser to have those values so you may be right here.

With AppArmor, at least, it is perfectly possible to assign different policies to the same program. Policies are applied to programs identified by pathname so all one needs to do to sandbox, for instance, /usr/bin/gcc:

1. ln /usr/bin/gcc-4.4 ~/sandbox/compilers/gcc 2. Create and enforce an apparmor policy for ~/sandbox/compilers/gcc 3. Remember to use only ~/sandbox/compilers/gcc for untrusted code.

I do this (among other things) for my platform, and given that I only require user-submitted code to solve one of a limited set of algorithmic challenges, I can get away with blocking access to /etc/passwd (and everything else but a restricted whitelist).

Re:Pastebin, compiler, and debugger supporting 40+ languages by Setsuna on Friday July 30, 2010 @01:46AM (#1560376)
Is running each code as a separate process really scalable?
Re:Pastebin, compiler, and debugger supporting 40+ languages by limmeau on Friday July 30, 2010 @03:15AM (#1560476)
They run a C++ compiler on user-supplied code. That should dominate context-switching overhead.
Re:Pastebin, compiler, and debugger supporting 40+ languages by ELV1S on Thursday July 29, 2010 @04:32PM (#1559144)
I built a Chrome extension that meets gist.github.com and ideone.com http://github.com/NV/run-this-gist. Alas, API doesn't work well in most cases http://ideone.com/tXexT.
Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Thursday July 29, 2010 @05:33PM (#1559337)
Nice idea. There is also a GistDoIt: http://www.gistdoit.com/about
Re:Pastebin, compiler, and debugger supporting 40+ languages by ELV1S on Thursday July 29, 2010 @05:58PM (#1559418)
If I knew about it wouldn't build mine.
Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Thursday July 29, 2010 @07:03PM (#1559628)
Why? The more options to choose, the better.
Re:Pastebin, compiler, and debugger supporting 40+ languages by Scriptor on Thursday July 29, 2010 @03:32PM (#1558920)
They have an API! http://ideone.com/api

I'd have to learn SOAP first, but I've been meaning to do a website similar to tryruby.com for one of my projects. This looks like it could definitely help.

Re:Pastebin, compiler, and debugger supporting 40+ languages by ELV1S on Thursday July 29, 2010 @04:26PM (#1559118)
Try http://run-this.appspot.com/ if you don't want to learn SOAP.
Re:Pastebin, compiler, and debugger supporting 40+ languages by mkilling on Friday July 30, 2010 @04:14AM (#1560550)
I wrote a Python wrapper that you can use without having to know SOAP: http://github.com/mkilling/ideone.py
Re:Pastebin, compiler, and debugger supporting 40+ languages by Pistos2 on Tuesday August 03, 2010 @01:20AM (#1570215)
Yesterday and today, I quickly wrote up a Ruby interface to the API: http://github.com/Pistos/ideone-gem
Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Thursday July 29, 2010 @05:35PM (#1559345)
There are some examples to help you start.
Re:Pastebin, compiler, and debugger supporting 40+ languages by duck on Thursday July 29, 2010 @04:36PM (#1559155)
I could see this useful for coding tests during interviews.
Re:Pastebin, compiler, and debugger supporting 40+ languages by bitsai on Thursday July 29, 2010 @06:42PM (#1559572)
see[Mike]code might be an even better fit for that purpose:

http://i.seemikecode.com/

Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Thursday July 29, 2010 @07:01PM (#1559622)
You can always use any of online judge services allowing you to set problem/organize contests (like http://spoj.pl) but how do you know your candidate is really solving the problem by himself?
Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Thursday July 29, 2010 @06:02PM (#1559426)
What is the advantage here?
Re:Pastebin, compiler, and debugger supporting 40+ languages by limmeau on Friday July 30, 2010 @08:36AM (#1560883)
You'd save the time needed to switch between environments if you want to examine the candidate in different languages.
Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Friday July 30, 2010 @09:27AM (#1561025)
Indeed, good point!
Re:Pastebin, compiler, and debugger supporting 40+ languages by Setsuna on Friday July 30, 2010 @01:50AM (#1560385)
Interesting! you can use java-scripting api for running jruby, jpython etc on server but how're they doing it for C/C++?
Re:Pastebin, compiler, and debugger supporting 40+ languages by jeebusroxors on Thursday July 29, 2010 @03:29PM (#1558913)
A nice feature (compared to codepad) is the ability to specify input.
Re:Pastebin, compiler, and debugger supporting 40+ languages by kuszi on Thursday July 29, 2010 @05:38PM (#1559353)
Right! You can specify even multiple inputs and clone them - helps while you need to modify/test a code snippet.
Re:Pastebin, compiler, and debugger supporting 40+ languages by friend_of_all on Friday July 30, 2010 @09:24AM (#1561019)
it is integrated with FB, nice!