Javascript File Sandbox

A sub-class of JsSandbox that reads the Javascript to execute from a static file.

class vxsandbox.worker.JsFileSandbox(options, config=None)[source]
class CONFIG_CLASS(config_data, static=False)[source]

Configuration options:

Parameters:
  • amqp_prefetch_count (int) – The number of messages fetched concurrently from each AMQP queue by each worker instance.
  • transport_name (str) – The name this application instance will use to create its queues.
  • send_to (dict) – ‘send_to’ configuration dict.
  • sandbox (dict) – Dictionary of resources to provide to the sandbox. Keys are the names of resources (as seen inside the sandbox). Values are dictionaries which must contain a cls key that gives the full name of the class that provides the resource. Other keys are additional configuration for that resource.
  • executable (str) – Full path to the executable to run in the sandbox.
  • args (list) – List of arguments to pass to the executable (not including the path of the executable itself).
  • path (str) – Current working directory to run the executable in.
  • env (dict) – Custom environment variables for the sandboxed process.
  • timeout (int) – Length of time the subprocess is given to process a message.
  • recv_limit (int) – Maximum number of bytes that will be read from a sandboxed process’ stdout and stderr combined.
  • rlimits (dict) – Dictionary of resource limits to be applied to sandboxed processes. Defaults are fairly restricted. Keys maybe names or values of the RLIMIT constants in Python resource module. Values should be appropriate integers.
  • logging_resource (str) – Name of the logging resource to use to report errors detected in sandboxed code (e.g. lines written to stderr, unexpected process termination). Set to null to disable and report these directly using Twisted logging instead.
  • sandbox_id (str) – This is set based on individual messages.
  • javascript_file (str) – The file containting the Javascript to run
  • app_context (str) – Custom context to execute JS with.