class MXC::Sandbox

A sandbox policy: what a command may read, write and reach, and how long it may run.

Setters return the sandbox, so they chain, and nil resets a setting to its default:

sandbox = MXC.sandbox
  .with_readable("app/skills")
  .with_writable(Rails.root.join("tmp"))
  .with_network(allow: ["pypi.org", "*.pythonhosted.org"])
  .with_timeout(30)
sandbox.run("python3 app/skills/build.py")
sandbox.run("python3", "app/skills/convert.py", params[:filename])

Subclasses declare the same settings with class macros:

class SkillSandbox < MXC::Sandbox
  readable "app/skills"
  writable "tmp/skills"
  network false
  timeout 30
end

SkillSandbox.new.run("python3 app/skills/build.py")