user314362
user314362

Reputation: 1235

Java Security Manager for JRuby

When using Java Security Manager for Jruby scripts, Is it possible give a particular script alone full permissions?

Upvotes: 1

Views: 498

Answers (2)

Charles Oliver Nutter
Charles Oliver Nutter

Reputation: 1426

There is potentially another answer: if you have separate security managers you want to apply to separate scripts, then you can always spin up separate JRuby instances in separate classloaders. They won't share anything and should remain pretty isolated. But Nick is right, there's nothing built into JRuby to sandbox individual scripts at the moment, and we don't have any plans to do so...

Upvotes: 1

Nick Sieger
Nick Sieger

Reputation: 3315

If you mean using the same security manager for different scripts that applies different permissions, then the answer is no, unless you write the security manager yourself to somehow be script-aware. There's no way to specify a script in a security policy file (like you would for classes). I see two options at the moment:

  1. Write a custom security manager that can be made aware of what script is running,
  2. Compile JRuby scripts to Java classes (using jrubyc --java) and apply the permissions to the different Java classes.

For help with 2, I suggest taking a look at Charlie's recent post.

Upvotes: 1

Related Questions