Egress
Egress is the proxy between a sandbox and the network. It has two forms:
| Form | Command | Serves |
|---|---|---|
| Egress sidecar | spotlight egress | One run on a host at a time. The host starts it next to the sandbox, starts it again with each run it delivers into the sandbox, and destroys it with the sandbox. The sandbox can send traffic only through it. |
| Shared egress | spotlight egress serve | The runs of the push pools that name it in provision.egress. One long-lived process serves many runs. See Shared egress. |
The sandbox is the security boundary gives the reasons. The sections before Shared egress describe the egress sidecar. The shared egress follows the same rules, except where its section says otherwise.
Topology
| Part | Value |
|---|---|
| Sandbox network | spotlight-<runner id>, an internal network. The sandbox joins only this network. |
| Egress container | spotlight-egress-<runner id>, on the sandbox network with the alias egress, and on SPOTLIGHT_SANDBOX_NETWORK or the engine's default network. |
| Egress image | SPOTLIGHT_EGRESS_IMAGE, default ghcr.io/usespotlightai/spotlight-runner:<release>, run with entrypoint spotlight egress. |
| Port | 3128 |
| Proxy address | http://sandbox:<credential>@egress:3128, in the sandbox's HTTP_PROXY and HTTPS_PROXY. The credential is random, for this sandbox alone. |
| Extra hosts entries | SPOTLIGHT_SANDBOX_HOSTS |
A client in the sandbox that ignores the proxy has no route out. See Inside a sandbox for the proxy and certificate variables.
On start, egress reads /run/spotlight/egress.json from the host and deletes
it. It fetches the run's secrets from Spotlight, for up to 1 minute. It then
listens, and writes its certificate authority for the host to lay into the
sandbox. The host waits up to 90 seconds for it. On SIGTERM it stops within 5
seconds and clears the secret values it stored.
The host also writes /run/spotlight-host/takeover.json into the egress
container of each sandbox. This file holds the sandbox's proxy credential,
extra hosts and the names of its harness keys, and no other secret. Egress does
not read or delete it, so a host that restarts can take over the sandbox. See
Updates.
The runner's proxy relay
The proxy address in the sandbox contains the sandbox's credential. Some
clients do not send the user name and password of a proxy address, and egress
answers them 407. An example is the postinstall script of ffmpeg-static.
Thus the runner opens a proxy relay at 127.0.0.1:3128, and gives it to the
harness, the setup commands and the change stack checks:
| Variable | Value |
|---|---|
HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy | http://127.0.0.1:3128 |
The other proxy and certificate variables stay as the host set them.
| Request to the relay | What the relay does |
|---|---|
CONNECT | Requests a CONNECT tunnel from egress to the same host and port, with the sandbox's credential. |
| A plain-HTTP request | Sends it to egress with the sandbox's credential. |
| Anything else | 400 The proxy relay accepts only an absolute URL or CONNECT. Send an absolute URL, or CONNECT to a host. |
Egress applies the same rules to these requests as to requests from the
sandbox, and the relay passes its answers back unchanged. When the relay cannot
reach egress, it answers 502.
A runner without SPOTLIGHT_EGRESS_URL opens the relay when the first proxy
variable that is set, in the order HTTPS_PROXY, https_proxy, HTTP_PROXY,
http_proxy, is an http address with a password. If the relay cannot open,
the runner logs
could not open the proxy relay, so the agent gets the egress address with its password,
and the agent gets the proxy address of the sandbox.
Allowed hosts
SPOTLIGHT_EGRESS_ALLOW | Allowed |
|---|---|
| unset or empty | Any host. |
| a list | Each exact host listed, and the subdomains of each *.<domain> entry. *.example.com allows api.example.com, not example.com. |
Host names are compared without regard to case. The Spotlight address, and the
storage hosts Spotlight names for the run, are always allowed. * alone is
rejected at host start.
Blocked addresses
Egress checks the address it connects to, after resolving the host name.
| Address | Blocked |
|---|---|
Loopback, link-local (including 169.254.169.254), multicast, unspecified, 0.0.0.0/8 | Always. |
Private (RFC 1918, IPv6 unique local), 100.64.0.0/10, 64:ff9b::/96, 2002::/16 | Unless an allow-list entry names the host. An empty allow-list names no host. |
| Any other | Never. |
TLS
| Property | Value |
|---|---|
| Certificate authority | One per run, ECDSA P-256, made by egress. The key stays in egress's memory. |
| Lifetime | 48 hours |
| Name constraints | The hosts egress injects a secret or a harness key for. With none, spotlight.invalid. |
| Intercepted | CONNECT to port 443 of a host egress injects a secret or a harness key for. HTTP/1.1, TLS 1.2 or later. |
| Not intercepted | Every other CONNECT, tunnelled to the host named in it. |
| Upstream trust | The egress image's system certificates, plus SPOTLIGHT_EGRESS_CA_BUNDLE. |
A client that pins certificates fails against an intercepted host. Egress
removes Proxy-Authorization from every request it passes on.
What egress injects into requests
On requests to the host a secret is bound to, egress replaces a request header or query parameter with the secret's value.
Harness keys
A host keeps the harness keys in its settings
and hands them to egress. The sandbox gets spotlight-egress:<NAME> in their
place. Harness keys that the workspace holds as
secrets are
run secrets. Egress replaces the header only when it contains exactly that stand-in,
with its prefix, as in authorization: Bearer spotlight-egress:OPENAI_API_KEY.
Egress logs one of these reasons and sends the request without the harness key:
the host's allow-list does not allow <host>it is empty or more than one line
Run secrets
A secret an MCP server's environment names, as secret.<NAME>, is injected for
the run. The MCP server gets spotlight-egress:<NAME>. So is a secret that the
harness profile names in secrets. The run's briefing tells the agent where to
send spotlight-egress:<NAME>. So is each
harness key of the run's
harness that the workspace holds as a secret. The harness gets
spotlight-egress:<NAME> in its environment. Egress replaces the
bound header only on requests to the bound host whose header contains that
stand-in, with or without the binding's prefix, as in
authorization: Bearer spotlight-egress:LINEAR_API_KEY. The stand-in must be
the whole value, or come right after the exact prefix. Other requests to the
host go out without the secret.
For a secret bound to a query parameter, egress replaces the parameter's value
only where it is the stand-in, or the prefix followed by the stand-in, as in
?key=spotlight-egress:MAPS_KEY. The other parameters keep their order and
encoding. Egress never logs the full URL. It answers a plain-HTTP or
intercepted request it could not pass on with only
Egress couldn't reach <host:port>., without the reason. See
spotlight_secret and
Give an MCP server a secret.
Egress gets each value from Spotlight, sealed to a key egress makes for the run (X25519, HKDF-SHA256, AES-256-GCM, bound to the run and the secret). Egress reads no secret from any other store.
Egress logs one of these reasons and sends the request without the run secret:
the host has a key of its own for <host>the host's allow-list does not allow <host>another secret is already injected in <Header> for <host>, orin ?<parameter> for <host>for a query parameterits location is neither a header nor a query parameterit names no header to inject it in, orit names no query to inject it init has more than one line, so egress cannot inject it into a request
On a request to a host egress has a secret or a harness key for, a header
or query parameter that contains a stand-in it doesn't put a value in, such as a
misspelt name, is removed before the request goes out, and egress logs
removed from a request a stand-in that egress has no value for with the header's or
parameter's name only.
Egress takes the secret back out of what the bound host answers before the
sandbox sees it. In the Location, Content-Location, Link and Refresh
headers, and in a text-like body (JSON, text/*, HTML, XML and form-encoded),
every spelling of the value is swapped back to its stand-in: as written,
query-escaped, path-escaped and escaped with lowercase hex, each with and
without the binding's prefix. A binary body, or one the host compressed, is
passed on as it is. Egress requests an uncompressed answer from the bound host. A
response it rewrites loses its Content-Length and is sent chunked.
The run's Spotlight token
A run of a setup chat uses Spotlight's own API. When egress fetches the run's secrets, Spotlight issues a workspace token for that run's attempt alone and seals it to egress, like a secret it stores.
| Property | Value |
|---|---|
| Scopes | plan, which includes read. |
| Issued by | The person who started the chat. Recorded in the audit as issued by Spotlight, with the run and its attempt. |
| Expires | An hour after egress fetches the run's secrets. |
| Revoked | When the run completes, is exhausted or cancelled, when the lease of its attempt expires or the run is suspended, or when the runner loses the run while egress fetches its secrets. Each fetch of the run's secrets revokes the run's earlier token for the same attempt, then issues a new one. |
| Stand-in | spotlight-egress:spotlight-api, in SPOTLIGHT_API_TOKEN. See The agent's environment. |
| Injected | In Authorization, as Bearer and the token, in place of the stand-in, Bearer and the stand-in, or Basic credentials whose password is the stand-in, on requests to the Spotlight address's host. Terraform's http backend sends the Basic form for the state backend. |
Egress injects it whatever the host's allow-list says, since the Spotlight
address is always allowed. When the Spotlight address is plain HTTP, as in
http://control-plane:3000 inside the host's network, egress also injects it
over plain HTTP, on that address's port only. No other secret is injected over
plain HTTP. Egress does not keep the token when the host has a key of its own
for the Spotlight address, or another secret is injected in Authorization for
it, and logs could not store the run's Spotlight token with the reason.
The token is not listed among the workspace's tokens. A run that uses Spotlight's API is reserved for a runner a push pool provisions only when the pool names an egress.
Responses
| Status | Message | Cause |
|---|---|---|
407 | Egress answers only the sandbox it was started for. | No proxy credential, or the wrong one. |
400 | Egress is a proxy. Please send it an absolute URL, or CONNECT to a host. | A request that is neither CONNECT nor an absolute URL. |
403 | Egress doesn't allow this sandbox to connect to <host>. | The allow-list does not allow the host. |
502 | Egress couldn't reach <host:port>. Error: Egress never opens a connection to <ip>. | A tunnelled CONNECT to an always-blocked address. |
502 | Egress couldn't reach <host:port>. Error: Egress opens a connection to private address <ip> only if the allow-list names the host. | A tunnelled CONNECT to a private address the allow-list does not name. |
502 | Egress couldn't reach <host:port>. Error: <reason> | Any other failure of a tunnelled CONNECT. |
502 | Egress couldn't reach <host:port>. | A plain-HTTP or intercepted request that failed for any of these causes. The reason and the URL are left out. |
502 | Egress could not intercept TLS for <host>. Error: <reason> | No certificate could be made for an intercepted host. |
Connections time out after 30 seconds, and TLS handshakes upstream after 15 seconds.
Egress start failures
These fail the run with The sandbox's egress didn't start. Error: <error>:
| Message | Cause |
|---|---|
the assignment has no credential for the sandbox's egress | The work came with no egress credential. |
egress was not ready within 1m30s | Egress did not publish its authority in time. |
pull the egress image <image>: <error> | The egress image could not be pulled. |
If Spotlight does not send the run's secrets, egress starts with no secrets to
inject and logs the control plane sent egress no secrets to inject. If it cannot reach
Spotlight within 1 minute, it logs
gave up fetching the run's secrets; the sandbox goes out with no injected secrets.
Calls sent from the network
A hook request or an
integration action
whose from is network waits until a host that reports to the workspace
claims it. The host sends it from a one-off egress container,
spotlight-egress-call-<id>, under the same allow-list and
address rules.
| Property | Value |
|---|---|
| Schemes | http and https |
| Redirects | Not followed |
| Tries | One |
| Response body | The first 256 KiB |
| Upstream trust | The egress image's system certificates, plus SPOTLIGHT_EGRESS_CA_BUNDLE |
Secrets of an action
The request of an integration action carries spotlight-egress:<NAME> in
place of each secret it names, and the claim carries a one-time token. Egress
makes a key for the call, and gives the token and the key's public half to
Spotlight at POST /api/hosts/calls/<id>/secrets, with no other credential.
Spotlight answers once, while the host that claimed the call has it.
Spotlight answers with each value sealed to the key egress makes for the call (X25519, HKDF-SHA256, AES-256-GCM, bound to the call and the secret).
Egress injects each secret only on the request to the host the secret is bound
to, and only if the host's allow-list allows that host. If egress cannot inject a secret that
the call names, it sends nothing, and the call's response is
Egress couldn't inject secret <NAME>, so it didn't send the call.
Egress refuses a Host header that differs from the host of the URL.
Egress asks the bound host for an uncompressed response. It replaces each
secret's value with its stand-in in every response header and in the body,
whatever its content type. A response with a Content-Encoding other than
identity loses its body, with
The response was compressed, so egress couldn't redact it.
Egress clears the values when it has sent the call.
The host gives the call only the time that is left until it expires.
Egress tries for up to 10 seconds to get the secrets. When Spotlight refuses
them, or does not answer in that time, egress does not send the call, and the
call's response is
Egress couldn't redeem the call's secrets, so it didn't send the call. Error: <reason>.
Shared egress
A shared egress is spotlight egress serve: one long-lived process that
serves the runs of every push pool that names it in
provision.egress. It keeps
each run's secrets in memory while the run's runner has a lease on the run. A push pool
without provision.egress has no egress: a run whose secrets egress injects,
or that uses Spotlight's API, is never reserved for its runners.
| Egress | Run by | Named in provision.egress as |
|---|---|---|
| The platform egress | The Spotlight deployment, which names it in SPOTLIGHT_PLATFORM_EGRESS_URL and SPOTLIGHT_PLATFORM_EGRESS_TOKEN. See Self-hosted Spotlight settings. | spotlight |
| A workspace's egress | You, with the token of a spotlight_egress. | The egress's id. |
| Part | Value |
|---|---|
| Binary | spotlight, as in the runner image ghcr.io/usespotlightai/spotlight-runner:<release>. Run spotlight egress serve; any other argument prints the usage and exits 1. |
| Listens | SPOTLIGHT_EGRESS_LISTEN, default :3128. HTTP/1.1 and HTTP/2, with TLS when a certificate is set. |
| Reached by | Each runner, at SPOTLIGHT_EGRESS_URL, with Proxy-Authorization: Basic of sandbox:<run proxy credential>. |
| Requests it takes | CONNECT over HTTP/1.1, a request that names its target in Spotlight-Egress-Target, and GET /.well-known/spotlight/bound. |
| Processes | Several processes can serve one egress with the same token. Each process keeps only the runs that reach it. |
Settings
| Variable | Default | Description |
|---|---|---|
SPOTLIGHT_URL | required | The Spotlight address. Egress calls Spotlight's API there. |
SPOTLIGHT_EGRESS_TOKEN | required | The egress token: the token of the spotlight_egress, or SPOTLIGHT_PLATFORM_EGRESS_TOKEN for the platform egress. |
SPOTLIGHT_EGRESS_LISTEN | :3128 | The address egress listens on. |
SPOTLIGHT_EGRESS_TLS_CERT, SPOTLIGHT_EGRESS_TLS_KEY | none | A certificate and its key, as PEM files. With both, egress serves TLS 1.2 or later. Give both or neither. |
SPOTLIGHT_EGRESS_ALLOW | none | The allow-list for every run egress serves, as a host's. See Allowed hosts. |
SPOTLIGHT_EGRESS_CA_BUNDLE | none | A PEM file of certificate authorities egress trusts upstream, in addition to its image's system certificates. |
SPOTLIGHT_EGRESS_RATE_LIMIT | 50 | Requests each second for each workspace. 0 is no limit. See Limits. |
SPOTLIGHT_EGRESS_MAX_CONNECTIONS | 200 | Open connections for each workspace. 0 is no limit. See Limits. |
SPOTLIGHT_HEALTH_ADDR | none | Where egress answers GET /healthz and GET /readyz, apart from the proxy. See Health checks. |
SPOTLIGHT_LOG_LEVEL | info | error, warn, info or debug. |
Allowed hosts and Blocked addresses apply as above. The Spotlight address's host, and the storage hosts Spotlight names for the run, are always allowed.
On a problem with its settings, egress logs each one, then egress stopped,
and exits 1:
| Message | Cause |
|---|---|
SPOTLIGHT_URL must be the address of the control plane, such as https://spotlight.example.com | SPOTLIGHT_URL is not an absolute URL with a host. |
SPOTLIGHT_EGRESS_TOKEN is required; it is the token the control plane issued for this egress | No token. |
SPOTLIGHT_EGRESS_ALLOW: <problem> | An allow-list entry that cannot be read, as for a host. |
SPOTLIGHT_EGRESS_TLS_CERT and SPOTLIGHT_EGRESS_TLS_KEY go together; set both or neither | Only one of the two is set. |
SPOTLIGHT_EGRESS_TLS_CERT and SPOTLIGHT_EGRESS_TLS_KEY: <error> | The certificate or the key cannot be read. |
SPOTLIGHT_EGRESS_RATE_LIMIT: "<value>" is not a number of requests each second, or 0 for no limit | A rate that is not a number, or is below 0. |
SPOTLIGHT_EGRESS_MAX_CONNECTIONS: "<value>" is not a number of open connections, or 0 for no limit | A count that is not a whole number, or is below 0. |
SPOTLIGHT_EGRESS_CA_BUNDLE: <error> | The file cannot be read. |
SPOTLIGHT_EGRESS_CA_BUNDLE: <path> has no PEM certificate | The file contains no PEM certificate. |
listen for sandboxes: <error> | Egress cannot listen on SPOTLIGHT_EGRESS_LISTEN. |
listen for health checks: <error> | Egress cannot listen on SPOTLIGHT_HEALTH_ADDR. |
On SIGINT or SIGTERM, egress stops within 5 seconds, sends the connection
records it still has, removes every run from its memory, and exits 0.
Credentials
| Credential | Stored by | Lets its holder |
|---|---|---|
| Egress token | The egress process. Spotlight stores only its hash. | Call Spotlight as the egress: authorize a runner, fetch the secrets of the runs it serves, check which runs are still active, and record their connections. No runner gets it, and only a holder of it can fetch the secrets that egress injects for a run. |
| Run proxy credential | The runner, from SPOTLIGHT_EGRESS_PROXY_CREDENTIAL. Spotlight makes one for each runner, puts it in the provision call, and stores only its hash. | Send traffic through egress. It is not accepted by Spotlight's API. |
Egress gives Spotlight the run proxy credential with its egress token.
Spotlight authorizes the runner only while the runner has not ended, its pool
names that egress, and the egress is in the runner's workspace. Egress answers a request
with no credential, or one Spotlight does not accept, with 407.
Runs it serves
| When | Egress |
|---|---|
| A runner's first request | Requests that Spotlight authorize the runner. |
| The runner has no lease on a run yet | Lets the runner reach only the Spotlight address's host. |
A request to any other host, or to /.well-known/spotlight/bound | Fetches the run's secrets, once. While the runner has no lease on a run, it tries again at most every 5 seconds. |
| Every 30 seconds | Checks with Spotlight which of its runs are still active, and removes the secrets of the others from its memory. |
| A run with no request open, and no request for 2 minutes | Removes the run from its memory. Its next request authorizes it again. |
Egress calls Spotlight with its egress token as a bearer token:
| Call | Answer |
|---|---|
POST /api/egress/authorize | The runner, its workspace and the Spotlight address's host. 401 for a token or a run proxy credential that Spotlight does not accept. |
POST /api/egress/secrets, with the run proxy credential | The run's secrets, sealed. 409 while the runner has no lease on a run yet. |
POST /api/egress/active-runs | active: the run proxy credentials whose runner still leases its run. At most 500 credentials in one request; more is answered 422. Egress sends them in batches. |
POST /api/egress/connections | 204. At most 2,000 records in one call; more is answered 422. Egress sends them in batches. |
The runner's local proxy
A runner given SPOTLIGHT_EGRESS_URL sends its own calls to Spotlight, its git
traffic and the working copy archives through egress, in CONNECT tunnels. After
it claims its work, it gets the list of bound hosts from egress, and opens the
runner's local proxy at 127.0.0.1:3128. A bound host is a host that a secret
of the run is bound to, or the Spotlight address's host for a run that uses
Spotlight's API, if the allow-list allows it.
The harness, the setup commands and the change stack checks get the local proxy in their environment:
| Variable | Value |
|---|---|
HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy | http://127.0.0.1:3128 |
NO_PROXY, no_proxy | localhost,127.0.0.1,::1 |
SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO | /etc/spotlight/egress/bundle.pem |
NODE_EXTRA_CA_CERTS | /etc/spotlight/egress/authority.pem |
NODE_USE_ENV_PROXY | 1 |
| Request to the local proxy | What the local proxy does |
|---|---|
CONNECT to port 443 of a bound host | Ends the TLS with its own certificate authority, and sends each request to egress with Spotlight-Egress-Target: <host>:443. Egress injects the secrets, sends the request on over HTTPS, and takes the secrets out of the answer. |
Any other CONNECT | Requests a CONNECT tunnel from egress to the same host and port. Egress does not decrypt it. |
| A plain-HTTP request | Sends it through a CONNECT tunnel to the host's port. Egress injects nothing into it. |
| Anything else | 400 The local proxy accepts only an absolute URL or CONNECT. Send an absolute URL, or CONNECT to a host. |
With SPOTLIGHT_EGRESS_TRAFFIC=bound, the local proxy connects to other hosts
directly, not through egress: only requests to bound hosts go to egress. The
runner's own traffic still goes through egress. The default is all. The
value comes from the pool's provision.egressTraffic, through
runner.egress.traffic in the provision call.
| Local proxy authority | Value |
|---|---|
| Certificate authority | One per runner, ECDSA P-256, made by the runner. The key stays in the runner's memory. |
| Lifetime | 48 hours |
| Name constraints | The bound hosts. With none, spotlight.invalid. |
| Files | /etc/spotlight/egress/authority.pem, and /etc/spotlight/egress/bundle.pem with the image's system certificates. It is also appended to each system bundle that exists in the image. |
| Certificates trusted for the egress connection | The image's system certificates. |
If the local proxy cannot open, the runner logs
could not open the local proxy, so the work fails, and the run fails before
the agent starts. A change stack check fails too, and the runner logs
could not check, because the local proxy did not open. If the authority of the
local proxy cannot be added to the bundles, the runner logs
could not trust the authority of the local proxy, so TLS through it can fail.
What a shared egress injects into requests
- Run secrets and the run's Spotlight token, as
above, on the requests the local proxy sends to egress. Those are HTTPS
requests to port
443of a bound host only. - Harness keys that the workspace holds as secrets, as run secrets. Keys the push pool's provisioner puts in the runner's environment enter the sandbox as they are.
- Values Spotlight keeps are sealed to a key the egress process makes when it starts. One key serves every run of the process.
- A forwarded request to a host that is not bound is blocked with
403. Egress logs the same reasons as above for a secret it does not inject.
Connection records
Egress records each connection it makes or blocks for a run, and sends the records to Spotlight every 5 seconds, at most 2,000 in one call. It keeps at most 10,000 records waiting, and sends again the records that Spotlight could not be reached for.
| Field | Contains |
|---|---|
host, port | Where the connection went. |
bytesOut | Bytes from the sandbox to the host. |
bytesIn | Bytes from the host to the sandbox. |
ms | How long the connection was open. |
outcome | passthrough: egress did not decrypt it. injected: egress decrypted it to inject a secret. blocked: egress stopped it. failed: egress could not open it. |
status | The status the host answered an injected request with. Not set on other records, because egress cannot read a passthrough connection. |
reason | Why egress blocked the connection or could not open it. See the table below. |
at | When it started, as egress says. Spotlight keeps that time only when it is at most 1 hour before, and at most 1 minute after, the time Spotlight gets the record. Otherwise it keeps its own time. |
A record contains no URL, method, header or body.
outcome | reason | When |
|---|---|---|
blocked | not-allowed | The allow-list does not allow the host. |
blocked | private-address | Egress blocks the address of the host. See Blocked addresses. |
blocked | not-bound | A forwarded request names a host that is not bound. |
failed | no-such-host | The host name has no DNS record. |
failed | timed-out | The host did not answer in time. |
failed | tls-failed | TLS to the host failed, for example because its certificate is not valid. |
failed | unreachable | Egress could not connect for another reason. |
Spotlight drops a record whose status or reason does not fit its
outcome. A connection that the sandbox closes before egress opens it is not
recorded.
Spotlight keeps each record with the run's attempt for 30 days. Egress sends the records of a run before it removes the run from its memory. Spotlight keeps a record when the run still names the runner of the proxy credential, and that runner is active, or ended at most 2 minutes before. It drops all other records, and the records of a check. The task trace shows them; see Run network and Connections in the trace.
Enforcement
Before the harness starts, a runner given SPOTLIGHT_EGRESS_URL tries a
direct TCP connection to the Spotlight address's host and port, for at most 3
seconds. It records an egress.checked event on the run:
| Direct connection | egress.checked | The trace reads |
|---|---|---|
| Fails | { "enforced": true } | Enforced |
| Succeeds | { "enforced": false } | Not enforced |
The state is what the runner in the sandbox reports. Spotlight does not check
it, and a sandbox that is not under the runner's control can report
enforced. A runner on a host does not check. When egress is not enforced, a client in
the sandbox that ignores the proxy goes out directly: the allow-list does not
apply to it, and egress records nothing for it. The sandbox still has only
stand-ins.
Limits
Each egress process counts each workspace's requests on its own. Every request
to egress counts, a CONNECT included.
| Limit | Setting | Default | Over the limit |
|---|---|---|---|
| Requests each second | SPOTLIGHT_EGRESS_RATE_LIMIT | 50 | 429 Sorry, this workspace sends more than <rate> requests each second through egress. Please send fewer requests. |
| Open connections | SPOTLIGHT_EGRESS_MAX_CONNECTIONS | 200 | 429 Sorry, this workspace has more than <n> connections open through egress. Please close some connections. |
A workspace can send up to the rate's number of requests at once.
Shared egress responses
| Status | Message | Cause |
|---|---|---|
407 | Egress answers only a sandbox that sends its proxy credential. | No proxy credential. |
407 | Egress does not know this sandbox. | Spotlight did not accept the run proxy credential. |
502 | Egress could not get an answer from the control plane about this sandbox. Please try again. | The control plane did not answer the request. |
502 | Egress could not get the run's secrets from the control plane. Please try again. | The run's secrets could not be fetched. |
400 | Egress takes a CONNECT, a request that names its target in Spotlight-Egress-Target, or GET /.well-known/spotlight/bound. | Any other request. |
403 | Egress does not allow this sandbox to connect to <host>. | The allow-list does not allow the host, or the runner has no lease on a run and the host is not the Spotlight address's. |
502 | Egress could not reach <host:port>. Error: <reason> | A tunnel could not be opened, an address egress blocks included. |
505 | Egress tunnels only over HTTP/1.1. Please CONNECT over HTTP/1.1. | A CONNECT over HTTP/2. |
400 | Spotlight-Egress-Target must be a host and port 443, such as api.example.com:443. | A forwarded request to another port. |
403 | Egress forwards a request only to a host that a secret of this run is bound to, and <host> is not one. Please CONNECT to other hosts. | A forwarded request to a host that is not bound. |
502 | Egress could not reach <host>. | A forwarded request that could not be sent on. The reason is left out. |
429 | See Limits. |
The local proxy passes each error response of egress on with its status and message. Its own failures are:
| Status | Message | Cause |
|---|---|---|
502 | The local proxy could not reach <host:port>. Error: <reason> | Egress could not be reached for a tunnel, or a direct connection failed. |
502 | The local proxy could not intercept TLS for <host>. Error: <reason> | No certificate could be made for a bound host. |
502 | The local proxy could not reach <host>. | A request to a bound host, or a plain-HTTP request, could not be sent on. |
Limitations
- Egress cannot itself send through another proxy.
- A shared egress injects no keys of its own. It injects the harness keys that the workspace holds as secrets.
- A shared egress injects secrets only over HTTPS, to port
443. OPENCODE_API_KEYand any other variable not listed under Harness keys enter the sandbox as they are.- Logins that refresh their own tokens are not added.