Skip to main content
See Networking, Outbound proxies, and Secrets for usage guides.

Creation options

Use these keywords with Sandbox.create, Sandbox.connect_or_create, or Sandbox.with. They are not separate Ruby builder methods.

network

Use :none to disable networking, or a hash containing both allowed_hosts and allowed_ports.

Fields

allowed_hostsArray<String>
Allowed destination hosts.
allowed_portsArray<Integer>
Allowed destination ports. Both host and port restrictions must match.

secrets

An array of hashes. Each entry requires all three string fields below. Ruby does not expose per-location substitution, violation-action, or passthrough-policy configuration.

Fields

envString
Guest environment variable receiving the secret placeholder.
valueString
Secret value to substitute into permitted requests.
allowed_hostString
Destination host allowed to receive the secret.

proxy

Accepts an OutboundProxy. The same object can be passed to builder.proxy(proxy).

OutboundProxy

Microsandbox::OutboundProxy.socks4()

Configure a SOCKS4 proxy.

Parameters

addressString
Proxy host and port, such as 127.0.0.1:1080.

Returns

OutboundProxy
Proxy configuration.

Microsandbox::OutboundProxy.socks5()

Configure a SOCKS5 proxy.

Parameters

addressString
Proxy host and port, such as 127.0.0.1:1080.

Returns

OutboundProxy
Proxy configuration.

proxy.user_id()

Set the SOCKS4 user ID. Raises ArgumentError for a SOCKS5 proxy.

Parameters

valueString
SOCKS4 user ID.

Returns

OutboundProxy
The proxy, for chaining.

proxy.credentials()

Set SOCKS5 credentials. Raises ArgumentError for a SOCKS4 proxy.

Parameters

usernameString
Proxy username.
passwordSecretSource
Proxy password source.

Returns

OutboundProxy
The proxy, for chaining.
The bang forms user_id! and credentials! mutate the proxy and return nil.

SecretSource

Microsandbox::SecretSource.env()

Read a secret from a host environment variable. Ruby exposes this source for proxy authentication.

Parameters

nameString
Non-empty environment variable name.

Returns

SecretSource
Environment-backed secret source.