RunSwift: Try Swift in Your Browser
runswiftlang.com
RunSwift: Try Swift in Your Browser
1–10 of 24 posts
Re: RunSwift: Try Swift in Your Browser
#2Re: RunSwift: Try Swift in Your Browser
#3Hi! I made RunSwift this past week and thought it was pretty neat so I wanted to share it. Have fun!
Re: RunSwift: Try Swift in Your Browser
#4Hi! I made RunSwift this past week and thought it was pretty neat so I wanted to share it. Have fun!
I've always wondered how these are made. Does it run in some kind of virtualised container?
I did a few things to get this running:
- The application server and build server are separate, with access control to the build server controlled by an API key that I can revoke should anyone gain access to it.
- The process that compiles and runs your code is an unprivileged user.
- All import statements are disabled in user submitted code
- Foundation is imported selectively with only a few classes allowed to be used by submitted code (namely, the NSString, NSArray, NSDictionary, etc APIs)
- Code is checked for a list of blacklisted APIs before hitting the compiler
- The execution of your code has a timeout of a few seconds, and the process will be killed should it take any longer.
I looked into more advanced techniques for sandboxing but couldn't find anything on OS X that was feasible. Happy to be schooled on security though, if you know better than I do :)
Re: RunSwift: Try Swift in Your Browser
#5Hi! I made RunSwift this past week and thought it was pretty neat so I wanted to share it. Have fun!
Re: RunSwift: Try Swift in Your Browser
#6Re: RunSwift: Try Swift in Your Browser
#7Earlier quoted context omitted.
Looks a lot like swiftstub.com. Nice job though.
Hah, had never seen that :) thanks for the link!
Re: RunSwift: Try Swift in Your Browser
#8I would like to see someone tackle this though.
Re: RunSwift: Try Swift in Your Browser
#9I dabbled with implementing Swift on JavaScript, but has proven a bit difficult. The grammar is very big and just implementing a parser is huge task on its own. I would like to see someone tackle this though.
Re: RunSwift: Try Swift in Your Browser
#10Earlier quoted context omitted.
I've always wondered how these are made. Does it run in some kind of virtualised container?
That's one way to do it, sure. In this case I had the problem of having to use a Mac for a build server, though. I did a few things to get this running: - The application server and build server are separate, with access control to the build server controlled by an API key that I can revoke should anyone gain access to it. - The process that compiles and runs your code is an unprivileged user. - All import statements…