简体   繁体   中英

How does scala sandboxing work

I've been looking at this:

http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html

regarding sandboxing the JVM. However, that was written three (four?) years ago now, and is for Java. I haven't managed to find anything more recent or specific.

I know I could probably do the same thing for Scala, but I was wondering if Scala had any inbuilt sandboxing capabilities? The use case is to do scripting and configuration in Scala (like how Lift does it) while still maintaining security (ie preventing config.scala opening network sockets or reading from the hard disk). Does anyone have any experience doing this?

You use the same mechanism as in Java: install a SecurityManager . The default ClassLoader will give loaded code a "read" FilePermission for its own classpath and an "exitVM" RuntimePermission; other actions require permissions .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM