Skip to content

Security: signalwire/signalwire-typescript

Security

docs/security.md

Security

export {}; // treat each example as a module (top-level await)
declare global {
  const agent: import('@signalwire/sdk').AgentBase;
  const AgentBase: typeof import('@signalwire/sdk').AgentBase; // used with `extends`
  const FunctionResult: typeof import('@signalwire/sdk').FunctionResult;
  const SslConfig: typeof import('@signalwire/sdk').SslConfig;
  const SessionManager: typeof import('@signalwire/sdk').SessionManager;
  const ssl: import('@signalwire/sdk').SslConfig;
  const Hono: any; // Hono framework
  const auth: any; // AuthHandler instance
  const app: any; // Hono app
  const cors: any; // Hono cors middleware
}

This page describes what the TypeScript SDK does to protect an agent's HTTP endpoints, what each setting changes, and what it leaves unprotected.

Table of Contents


Overview

An AgentBase app applies these protections to the routes it serves. The first three are always on; the others are opt-in through options or environment variables.

  • Basic auth: every agent route except /health and /ready requires the agent's credentials.
  • Security headers: X-Content-Type-Options, X-Frame-Options, X-XSS-Protection, Referrer-Policy, Content-Security-Policy and Permissions-Policy on the agent's responses.
  • Secure tools: a tool is secure unless you pass secure: false, and a secure tool runs only with a valid per-call token.
  • Webhook signatures: with a signing key set, POSTs to the SWML, SWAIG and post-prompt routes must carry SignalWire's signature.
  • CORS, CSRF, rate limiting, host validation and request size: controlled by SWML_CORS_ORIGINS, SWML_CSRF_PROTECTION, SWML_RATE_LIMIT, SWML_ALLOWED_HOSTS and SWML_MAX_REQUEST_SIZE.
  • Outbound URL checks: the SDK's own fetches of URLs a caller, the model or a skill's configuration supplies refuse private and internal addresses.

Authentication

Basic Auth (Default)

Every AgentBase app requires HTTP basic auth on the SWML route (/), /swaig, /post_prompt, /debug_events, /mcp, the optional override routes and any routing-callback path. The /health and /ready routes need no credentials, so a request to them doesn't test your credentials.

The agent resolves its credentials in this order:

  1. The basicAuth: [user, password] constructor option.
  2. A config file's security.auth.basic (or security.basicAuth) section, when you pass configFile.
  3. SWML_BASIC_AUTH_PASSWORD from the environment, with SWML_BASIC_AUTH_USER as the username. The username defaults to signalwire when only the password is set.
  4. A generated password: 32 random hex characters, with SWML_BASIC_AUTH_USER or the agent's name as the username.

A generated password exists only in the running process, and the agent logs a basic_auth_password_autogenerated warning when it makes one. The startup log line shows the username and **** in place of any password, so don't look for the password there:

Auth: my-agent:**** (source: generated)

Set the credentials yourself for any agent SignalWire or another client calls. This example passes them to the constructor from environment variables your deployment defines, and refuses to start without them, so a missing variable can't leave a known password in place:

import { AgentBase } from '@signalwire/sdk';

const user = process.env.AGENT_USER;
const password = process.env.AGENT_PASSWORD;
if (!user || !password) throw new Error('Set AGENT_USER and AGENT_PASSWORD');

const agent = new AgentBase({ name: 'my-agent', basicAuth: [user, password] });

In code, getBasicAuthCredentials() returns the credentials in use, and getBasicAuthCredentials(true) adds where they came from:

const [user, pass] = agent.getBasicAuthCredentials();
const [user2, pass2, source] = agent.getBasicAuthCredentials(true);
// source: 'provided' | 'environment' | 'config file' | 'generated'

The agent puts the credentials into the webhook URLs of the SWML it serves (https://user:password@host/swaig?...), so SignalWire can call back. Anyone who can read that SWML can read the password. The SWML route itself requires the credentials.

Every route that requires basic auth passes the request's credentials to validateBasicAuth(), which compares them with the configured pair in constant time. Override it to add a check of your own; an override replaces the comparison, so call super.validateBasicAuth() to keep it.

AuthHandler (Multi-Method)

AuthHandler (src/AuthHandler.ts) is a standalone helper for your own Hono or Express routes. The agent's own routes don't use it. It accepts a bearer token, an API key header, basic auth credentials and a custom validator, and compares secrets in constant time:

import { AuthHandler } from '@signalwire/sdk';

const auth = new AuthHandler({
  // Authorization: Bearer <token>
  bearerToken: 'a-long-random-token',

  // X-Api-Key: <key> (apiKeyHeader changes the header name)
  apiKey: 'a-long-random-key',

  // Authorization: Basic <base64 of user:password>
  basicAuth: ['admin', 'a-long-random-password'],

  // Receives the headers; method and url are passed as empty strings
  customValidator: async (req) => req.headers['x-internal-service'] === 'trusted',

  // Deny every request when no method is configured
  allowUnauthenticated: false,
});

validate() tries the configured methods in order (bearer token, API key, basic auth, custom validator) and allows the request when one of them matches. With no method configured, it allows every request and logs a warning, unless allowUnauthenticated is false.

middleware() returns Hono middleware that answers a failed check with 401 and { "error": "Unauthorized" }. expressMiddleware() does the same for Express-style apps. This fragment protects the routes under /api/:

const app = new Hono();
app.use('/api/*', auth.middleware());

Webhook Signature Validation

SignalWire signs the webhooks it sends with the Signing Key from your space's API credentials. With the key set, the agent checks each signature before it runs the handler. Without it, anyone who has the basic auth credentials can send the agent a request that looks like SignalWire's.

Enabling Validation

Pass signingKey to the constructor, or set SIGNALWIRE_SIGNING_KEY. The option wins when both are set:

import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({
  name: 'my-agent',
  signingKey: process.env.SIGNALWIRE_SIGNING_KEY,
  webhookTrustProxy: false, // set true only when you control every proxy in front of the agent
});

When neither is set, the agent logs this warning when it's created:

[signalwire] webhook signature validation is disabled — set signingKey or SIGNALWIRE_SIGNING_KEY to enable

The resolved key is readable as agent.signingKey, which is null when validation is off. The SDK doesn't log it or put it in the SWML.

Routes That Check It

With a key set, the agent checks the signature on POST requests to these routes, after basic auth:

  • The SWML route (/), with and without a trailing slash
  • /swaig
  • /post_prompt
  • Every routing-callback path, since it renders SWML like the root

A request with a missing or wrong signature gets 403 with the body Forbidden, and the handler doesn't run. The check applies however the app is served: serve(), getApp(), asRouter(), AgentServer, or a serverless adapter.

These requests aren't checked: GET requests to any route, /mcp (MCP clients don't sign requests), /debug_events, /post_prompt_override, /check_for_input, /health and /ready. SWMLService has no signature check.

What Is Signed

The agent accepts either of two headers:

  • X-SignalWire-Sha256-Signature: the lowercase hex HMAC-SHA256 of the URL followed by the raw body. The agent checks it first when it's present.
  • X-SignalWire-Signature: the SHA-1 signature. It decides when the SHA-256 header is missing or doesn't match. X-Twilio-Signature is accepted in its place for cXML compatibility.

The SHA-1 header can carry either of two schemes, and the validator tries both:

  • JSON requests (SWML, SWAIG, post-prompt): hex(HMAC-SHA1(key, url + rawBody)).
  • Form-encoded requests (cXML): the base64 HMAC-SHA1 of the URL followed by each form parameter's name and value, sorted by name. The validator tries the URL with and without the default port (:443 or :80). When the URL carries a bodySHA256 query parameter, the SHA-256 hex digest of the body must equal it.

url is the full URL SignalWire requested: scheme, host, any non-standard port, path and query string. rawBody is the body as it arrived, before JSON parsing. The middleware reads the raw body itself, before any parser, and leaves it in the Hono context as c.get('rawBody').

These test vectors come from the Python SDK's documentation, and the TypeScript validators accept them:

Scheme Signing key URL Body Signature
JSON, SHA-1 PSKtest1234567890abcdef https://example.ngrok.io/webhook {"event":"call.state","params":{"call_id":"abc-123","state":"answered"}} c3c08c1fefaf9ee198a100d5906765a6f394bf0f
Form 12345 https://mycompany.com/myapp.php?foo=1&bar=2 CallSid=CA1234567890ABCDE, Caller=+14158675309, Digits=1234, From=+14158675309, To=+18005551212 RSOYDt4T1cUTdK1PDd93/VVr8B8=
JSON on a form endpoint PSKtest1234567890abcdef https://example.ngrok.io/webhook?bodySHA256=69f3cbfc18e386ef8236cb7008cd5a54b7fed637a8cb3373b5a1591d7f0fd5f4 {"event":"call.state"} dfO9ek8mxyFtn2nMz24plPmPfIY=

validateWebhookSignature() accepts the first and third rows, and validateRequest() accepts the second, with the form parameters passed as an object. For the first row's URL and body, validateWebhookSignatureSha256() accepts 2a29f8a92b11df39da80c3b185fd62173d49c294184da585ff951eae4433571c.

URL Reconstruction Behind a Proxy

The signature covers the URL SignalWire requested, which differs from the URL the agent sees behind a reverse proxy or tunnel. The middleware rebuilds it in this order:

  1. SWML_PROXY_URL_BASE, joined with the request's path and query.
  2. X-Forwarded-Proto and X-Forwarded-Host, only when webhookTrustProxy is true. The protocol defaults to https.
  3. The URL the request arrived on.

Forwarded headers are easy to forge, so turn on webhookTrustProxy only when you control every proxy in front of the agent. SWML_TRUST_PROXY_HEADERS is a separate setting: it lets the agent build its webhook URLs and rate-limit keys from forwarded headers, and it doesn't affect the signature check.

On a serverless platform, the adapter passes the URL the platform received the request on, so the signature is checked against that URL. The Serverless Guide covers each platform. If signed requests are refused with 403, set SWML_PROXY_URL_BASE to the public base URL SignalWire calls.

Validating in Your Own App

Outside AgentBase, use webhookValidationMiddleware() on your Hono routes. It takes the same signingKey and trustProxy options, and throws at construction when the key is empty:

import { webhookValidationMiddleware } from '@signalwire/sdk';

const app = new Hono();
app.use(
  '/webhook',
  webhookValidationMiddleware({ signingKey: process.env.SIGNALWIRE_SIGNING_KEY! }),
);
app.post('/webhook', (c: any) => c.json({ received: c.get('rawBody') }));

For other frameworks, validate(method, url, headers, rawBody, signingKey) returns null for an authentic request, or a [403, {}, 'Forbidden'] triple to send back. The lower-level validateWebhookSignature(), validateWebhookSignatureSha256() and validateRequest() return a boolean. All of them throw when the signing key is empty.

What a Signature Doesn't Cover

The signature has no timestamp, so it doesn't stop a captured request from being sent again. Make side effects idempotent. The per-call tool tokens described in Secure Tools (HMAC Tokens) limit a replayed tool call to the same call and tool, until the token expires. The signature also doesn't cover the HTTP method or the headers.


Secure Tools (HMAC Tokens)

SessionManager (src/SessionManager.ts) signs a token for each secure tool in each call, so a tool's URL can't be reused for another call or another tool.

How It Works

A tool is secure unless you pass secure: false to defineTool(). These steps connect a secure tool's token to the call:

  1. SignalWire requests the SWML for a call with a POST whose body carries the call_id. For a GET, the agent reads ?call_id= from the query.
  2. The agent signs a token for each secure tool and that call_id, and appends it to the tool's web_hook_url as __token.
  3. When /swaig receives a call to a secure tool, the agent checks the token against the function name and the call_id in the request body.

A missing token, a missing call_id or an invalid token gets the same refusal, returned as the tool's response with HTTP 200:

{
  "response": "I'm sorry, the security token for this function is invalid or expired. I cannot execute this action."
}

The handler doesn't run. A tool with secure: false runs for anyone who has the basic auth credentials. With a dynamic config callback or addPerCallConfig(), the agent checks the token on the per-request copy. A secure tool that the callback registers needs its token too.

This example registers a tool that moves money, so it keeps the default and runs only with its call's token:

agent.defineTool({
  name: 'transfer_funds',
  description: 'Transfer money between accounts',
  parameters: {
    type: 'object',
    properties: {
      amount: { type: 'number', description: 'Amount to transfer' },
      toAccount: { type: 'string', description: 'Destination account ID' },
    },
  },
  secure: true, // the default; shown for clarity
  handler: async (args, rawData) => {
    // Runs only with a valid, unexpired token for this call
    return new FunctionResult('Transfer completed.');
  },
});

To call a secure tool by hand, request the SWML with ?call_id=<id> and take the tool's web_hook_url from it. Then POST to that URL with the same call_id in the body. swaig-test does this for you: it requests the SWML and calls each function at the URL the SWML gives it, token included.

Token Format

A token is the base64url encoding of five dot-separated fields:

base64url( callId.functionName.expiry.nonce.signature )
Field Description
callId The call the token is bound to. It may itself contain dots (a composed ID such as root.2), so the other four fields are read from the right.
functionName The tool the token authorizes.
expiry Unix time in seconds when the token stops being valid.
nonce 16 random hex characters.
signature The full 64-character hex HMAC-SHA256 of callId:functionName:expiry:nonce, compared in constant time.

Token Lifetime

AgentBase signs tokens that last 3600 seconds (one hour) by default. A token is signed when the SWML is rendered at the start of the call, so a tool called later than the expiry is refused. Set tokenExpirySecs longer than your longest call:

const agent = new AgentBase({
  name: 'my-agent',
  tokenExpirySecs: 7200, // 2 hours
});

A SessionManager you construct yourself defaults to 900 seconds.

The Signing Secret

The agent signs tokens with the first secret it finds: the swaigSecret option, then SIGNALWIRE_SWAIG_SECRET, then 32 random bytes generated at startup.

With the generated secret, tokens stop validating when the agent restarts, and each replica of the same agent signs with a different key. A call that started before a restart, or whose next request reaches another replica, gets the refusal shown earlier. The failure reads as a tool error, and the server logs only a token_invalid warning.

Set the secret whenever the agent restarts while calls are live (every rolling deploy does this) and whenever more than one replica serves the agent. Use the same value on every replica, and keep it out of source control:

const agent = new AgentBase({
  name: 'my-agent',
  swaigSecret: process.env.SIGNALWIRE_SWAIG_SECRET,
});

This secret belongs to the agent and never leaves the process. It's unrelated to the signing key, which SignalWire issues and uses to sign requests to the agent.

The Post-Prompt Token

The post-prompt URL in the SWML carries a token for its call too, signed for the name post_prompt. The agent refuses a summary POSTed to /post_prompt without a valid token with 403 and {"error": "Invalid or missing token"}. When the URL's call_id and the body's call_id differ, it answers 400, so a token for one call can't deliver another call's summary.

Debugging Tokens

debugToken() decodes a token without validating it, for troubleshooting. It works only when you set debugMode, and it shortens the call ID and signature in its output:

import { SessionManager } from '@signalwire/sdk';

const sm = new SessionManager(3600);
sm.debugMode = true;
const token = sm.generateToken('my_function', 'call-123');
const info = sm.debugToken(token);
console.log(info.components?.function, info.status?.is_expired);

Session Metadata

SessionManager also stores metadata per session in memory. It isn't shared between processes, and entries older than the token lifetime are removed when the store passes 1000 sessions:

const sm = new SessionManager();

sm.setSessionMetadata('session-1', { userId: 'u-42', plan: 'pro' });
const meta = sm.getSessionMetadata('session-1'); // { userId: 'u-42', plan: 'pro' }

sm.deleteSessionMetadata('session-1');

SSL/TLS

AgentBase.serve() and AgentServer.run() serve HTTPS when SWML_SSL_ENABLED is true, 1 or yes and SWML_SSL_CERT_PATH and SWML_SSL_KEY_PATH name the certificate and key; otherwise they serve plain HTTP. The agent's webhook URLs then use https, on SWML_SSL_DOMAIN when it's set. You can also terminate TLS at a reverse proxy or load balancer; then set SWML_PROXY_URL_BASE to the agent's public https:// URL so its webhook URLs use it.

SslConfig (src/SslConfig.ts) holds the certificate settings the agents, SWMLService.serve() and WebService use to serve HTTPS, and that your own servers can use. It reads these variables when you don't pass the matching option:

Variable Description
SWML_SSL_ENABLED true enables SSL.
SWML_SSL_CERT_PATH Path to the PEM-encoded certificate file.
SWML_SSL_KEY_PATH Path to the PEM-encoded private key file.
SWML_SSL_DOMAIN Domain name for HSTS.

This example builds the configuration from options:

import { SslConfig } from '@signalwire/sdk';

const ssl = new SslConfig({
  enabled: true,
  certPath: '/etc/ssl/certs/agent.pem',
  keyPath: '/etc/ssl/private/agent-key.pem',
  domain: 'agent.example.com',
  hsts: true, // default: true
  hstsMaxAge: 31536000, // default: 31536000 (1 year)
});

SslOptions Interface

Property Type Default Description
enabled boolean false Whether SSL is enabled.
certPath string none Path to the PEM certificate file.
keyPath string none Path to the PEM private key file.
domain string none Domain name for HSTS.
hsts boolean true Whether to emit HSTS headers.
hstsMaxAge number 31536000 HSTS max-age value in seconds.

Using SslConfig

isConfigured() is true when SSL is enabled and both files exist. getServerOptions() reads them for https.createServer(), and getHstsHeader() returns the header value, or null when HSTS or SSL is off:

if (ssl.isConfigured()) {
  const serverOpts = ssl.getServerOptions(); // { cert: '...', key: '...' }
}
const hsts = ssl.getHstsHeader(); // "max-age=31536000; includeSubDomains"

The agent doesn't send Strict-Transport-Security. To add it to your own Hono app, use hstsMiddleware():

app.use('*', ssl.hstsMiddleware());

Custom CA Certificates for Outbound TLS

Two variables set the certificate authorities the SDK trusts when it connects to SignalWire. SIGNALWIRE_REST_CA_FILE applies to the REST client (HttpClient), and SIGNALWIRE_RELAY_CA_FILE to the RELAY WebSocket (RelayClient). Each names a PEM bundle, for example for a private CA or a TLS-inspecting proxy.

The bundle replaces Node's default trust store for that connection, so it must contain every CA the server's certificate can chain to. Neither setting disables certificate verification. When a variable is unset, or its file can't be read, the connection uses Node's default trust store.


Security Headers

AgentBase and AgentServer set these headers on the responses of the agent's own routes:

Header Value
X-Content-Type-Options nosniff
X-Frame-Options DENY
X-XSS-Protection 1; mode=block
Referrer-Policy strict-origin-when-cross-origin
Content-Security-Policy default-src 'none'; frame-ancestors 'none'
Permissions-Policy camera=(), microphone=(), geolocation=()

They need no configuration. An app you add with mount() keeps its own headers, since a page couldn't load under default-src 'none'.


CORS

When SWML_CORS_ORIGINS is unset, the agent's CORS policy allows any origin (Access-Control-Allow-Origin: *) without credentials. Set it to a comma-separated list of origins to allow only those:

export SWML_CORS_ORIGINS="https://app.example.com,https://admin.example.com"

With the list set, a listed origin gets CORS headers with Access-Control-Allow-Credentials: true, and other origins get none, so browsers block their cross-origin requests. A list that holds *, or an unset variable, allows any origin, without credentials. AgentServer reads the same variable.


CSRF Protection

Set SWML_CSRF_PROTECTION=true to refuse POST requests from browser origins you haven't listed. The check uses the SWML_CORS_ORIGINS list:

export SWML_CORS_ORIGINS="https://app.example.com"
export SWML_CSRF_PROTECTION=true

A POST whose Origin header isn't in the list gets 403 and { "error": "Origin not allowed" }. A request without an Origin header passes, as SignalWire's requests do. When SWML_CORS_ORIGINS is unset, the check refuses nothing.


Rate Limiting

Set SWML_RATE_LIMIT to a positive number of requests per minute to limit request rates:

export SWML_RATE_LIMIT=120

The limit applies per client key, and the counter for a key resets 60 seconds after its first request. A request over the limit gets 429 and { "error": "Rate limit exceeded" }. Every route counts, /health and /ready included.

The client key depends on SWML_TRUST_PROXY_HEADERS:

  • Unset: the key is the address of the connection, or on a serverless platform the client address the platform reports (Lambda's source IP, a Cloud Function request's ip, CGI's REMOTE_ADDR). Azure Functions reports none, so its requests share one key. Behind a proxy, the key is the proxy's address, so every client behind it shares one key.
  • true: the key is the first address in X-Forwarded-For, then X-Real-IP, then the connection's address. Set this only behind a proxy that sets those headers, since a client can send any value.

Size the limit for the traffic one key sends, including SignalWire's requests during calls. When SWML_RATE_LIMIT is unset, no limit applies.


Host Validation

Set SWML_ALLOWED_HOSTS to a comma-separated list of host names the agent answers to:

export SWML_ALLOWED_HOSTS="agent.example.com,api.example.com"

The agent strips the port from the Host header and compares the rest, ignoring case, with the list. A request for another host gets 403 and { "error": "Forbidden: host not allowed" }, on every route including /health. A list that holds *, or an unset variable, accepts any host. There are no partial wildcards such as *.example.com.

The check blocks requests that reach the agent by IP address or through a DNS name you didn't list, as in DNS rebinding.


Request Size Limits

The agent refuses a request whose Content-Length header exceeds SWML_MAX_REQUEST_SIZE bytes, with 413 and { "error": "Request too large" }. The default is 1048576 bytes (1 MB):

# Limit to 512 KB
export SWML_MAX_REQUEST_SIZE=524288

The check reads only the header. A request without Content-Length, such as a chunked upload, isn't limited by it, so enforce a body limit at your proxy as well.


Outbound URL Protection (SSRF)

Some SDK features fetch URLs that a caller, the model or a skill's configuration supplies. To keep those fetches away from internal services, the SDK refuses a URL that isn't http or https. It also refuses a host that can't be resolved, or that resolves to any address in these ranges:

  • IPv4 private networks: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
  • Loopback and unspecified: 127.0.0.0/8, 0.0.0.0/8, ::1, ::
  • Link-local, including cloud metadata services: 169.254.0.0/16, fe80::/10
  • IPv6 unique local: fc00::/7
  • IPv4-mapped IPv6 addresses (::ffff:169.254.169.254), checked as the IPv4 address they carry

The web_search and spider skills, and the swaig-test DataMap simulator, fetch pages through a guarded client. It checks the URL and every redirect before requesting it: up to 10 redirects for the skills, and up to 15 for the simulator, which follows them as the platform's curl does and sends a POST again with its body. It connects only to an address it checked, which also stops DNS rebinding. A redirect to another origin drops the Authorization, Cookie and Proxy-Authorization headers. The mcp_gateway skill and native_vector_search in remote mode send every request to gateway_url or remote_url through the same client. With allow_insecure_tls on, mcp_gateway still uses this client, which then skips only the certificate check.

Two variables change this behavior:

  • SWML_ALLOW_PRIVATE_URLS=true (or 1, yes) turns the address checks off. Use it only when an agent must reach a service on a private network, such as a gateway on localhost in development.
  • SWML_URL_FETCH_USE_PROXY=true (or 1, yes) lets the guarded client use the environment's proxy when Node would use one. Node uses a proxy when NODE_USE_ENV_PROXY or --use-env-proxy is set, HTTPS_PROXY or HTTP_PROXY names one, and NO_PROXY doesn't exclude the host. The address check can't apply to a proxied connection, so use a proxy that restricts destinations itself.

These checks cover the SDK's own fetches. They don't cover fetch() calls in your tool handlers, or DataMap webhooks, which SignalWire makes. To check a URL in your own code, call validateUrl(), which resolves the host and returns false for a URL the SDK would refuse:

import { validateUrl } from '@signalwire/sdk';

console.log(await validateUrl('http://169.254.169.254/latest/meta-data/')); // false

Production Checklist

Check these settings before an agent takes production traffic:

  • Set basic auth credentials with basicAuth or SWML_BASIC_AUTH_USER and SWML_BASIC_AUTH_PASSWORD. A generated password exists only in one process, and SignalWire can't use it after a restart.
  • Set signingKey or SIGNALWIRE_SIGNING_KEY so the agent checks SignalWire's signatures. If the agent is behind a proxy or tunnel, set SWML_PROXY_URL_BASE to its public URL.
  • Set swaigSecret or SIGNALWIRE_SWAIG_SECRET, with the same value on every replica, so tool tokens survive restarts and work across replicas.
  • Set tokenExpirySecs longer than your longest call.
  • Keep secure on (the default) for every tool that reads or changes private data, moves money, or controls the call.
  • Terminate TLS in front of the agent, and set SWML_PROXY_URL_BASE to the https:// URL SignalWire should call.
  • Set SWML_ALLOWED_HOSTS to the host names the agent serves.
  • Set SWML_CORS_ORIGINS if a browser app calls the agent, and add SWML_CSRF_PROTECTION=true.
  • If you set SWML_RATE_LIMIT, size it for the agent's total traffic, or set SWML_TRUST_PROXY_HEADERS=true behind a proxy that sets X-Forwarded-For.
  • Leave SWML_ALLOW_PRIVATE_URLS unset unless the agent must reach a private service.
  • Set SIGNALWIRE_LOG_LEVEL=warn or error if debug logs would record call data you don't want kept.
  • Point load balancer health checks at /health or /ready, which need no credentials.

There aren't any published security advisories