2

Is it possible to implement some kind of JVM sandbox for running application ? I'd like to restrict access of this application for example to files IO, network, etc.

Is any way to control these resources access for running app inside of JVM in this sandbox ?

alexanoid
  • 24,051
  • 54
  • 210
  • 410

3 Answers3

4

That's what SecurityManager is for.

They even have a tutorial.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
2

In addition to the JVM's security manager you can also use OS-specific security mechanisms. The simplest is running the JVM under a separate user.

More advanced isolation techniques exist on various platforms. For example linux has seccomp-bpf, namespaces, selinux, capabilities and various other things. Firejail and systemd-nspawn make use of them.

the8472
  • 40,999
  • 5
  • 70
  • 122
1

Maybe alibaba's jvm-sandbox ,you can try.

Deipss
  • 11
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 03 '23 at 08:11