Class: Silas::Sandbox::Null

Inherits:
Object
  • Object
show all
Defined in:
lib/silas/sandbox/null.rb

Overview

The default: code execution is off. run_code isn't even advertised to the model unless a real sandbox is configured, so this only fires on direct misconfiguration — and it fails loud (SandboxDisabledError is a Silas::Error, so the Ledger propagates it rather than silently failing the invocation).

Instance Method Summary collapse

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


8
# File 'lib/silas/sandbox/null.rb', line 8

def enabled? = false

#run(_command, files: {}, timeout: nil) ⇒ Object



10
11
12
13
14
# File 'lib/silas/sandbox/null.rb', line 10

def run(_command, files: {}, timeout: nil)
  raise SandboxDisabledError,
        "code execution is disabled (config.sandbox = :none). " \
        "Set config.sandbox = :docker (and config.sandbox_image) to run untrusted commands."
end