Skip to Content

Security

One owner

SwB has one owner. The owner approves agent sign-ins and uses the SwB console to manage access and save tokens.

Sign-in for agents

OAuth lets an app sign in with the owner's approval. SwB uses PKCE with S256 to verify that the same app starts and completes sign-in. SwB ties each OAuth token to an address for /mcp. By default, access tokens last one hour and refresh tokens last 30 days. SwB replaces each refresh token after use. It stores SHA-256 hashes of OAuth tokens, which are fingerprints it uses to check the tokens. Agents can also use a configured key or redeem a pairing code for a key.

Trust

SwB checks sender IDs from the platform to set message trust.

TrustWho
ownerYou and your own signed-in agents
externalOther senders, including people and bots listed in known

On Slack, Discord and Telegram, known helps SwB choose whose messages to accept. Messages from these outside senders keep external trust. See GitHub owner accounts for how SwB checks GitHub authors.

A trust frame is the header and markers SwB adds to external text. SwB changes copies of its header or markers in the text before it adds the frame. The markers are <<<swb-untrusted and swb-untrusted>>>. Agents treat the text between them as information only.

A summary from Watch mode carries external trust. Each excerpt includes a trust frame for external text. SwB checks the author of each GitHub text field.

A companion key works only for its device connection. SwB keeps only a hash of the key to check it. SwB marks device results as external and puts their free text in a trust frame.

Visibility

A resource is a target, channel, memory scope, route or tool. The default access rule is private for the owner and their agents. You can share resources with a workspace or selected people. Tools stay private. Outside senders can reach a target when both the channel and target rules allow them. When SwB saves a message as context, it goes to the inbox as information. The agent stays asleep.

Keys with limits

Use auth.key_scopes to limit routing, message and conversation access. A paired key can read only the messages and conversations of its agent within those limits.

SwB saves memory grants for each paired key. When it upgrades old grants, SwB gives active paired keys with broad access general and the projects that exist at that time. For keys with named scopes in auth.key_scopes, SwB copies those scopes.

An unrestricted OAuth client or configured key can access all memory as the owner. Use auth.key_scopes to limit memory access by agent name. A restricted credential needs a grant that names the private project.

auth.key_tools limits the tools a key can call. auth.key_targets limits where it can send.

Tokens

Enter tokens on their claim pages. SwB uses a key in the data folder to encrypt tokens it saves. Status shows the names of missing variables and hides their values. The Capy key goes in a request header to api.capy.ai by default.

Open Tokens to see the memory scopes for each paired key. Select Remove scope next to a scope to remove that grant.

A new paired key gets its own agent scope when it redeems its pairing code. It also gets the project named in the code and the scopes named in auth.key_scopes.<agent>. To expand access, set the extra scopes or include a project in the pairing code. Then pair a new key.

Limits

LimitValue
Invalid bearer keys20 attempts per address in 10 minutes, then HTTP 429
GitHub events routed from senders outside owner accounts5 per sender in the last 10 minutes
/register20 per address per hour
/token120 per address in 10 minutes
/authorize60 per address in 10 minutes
Wrong codes at /companion/pair10 per address in 10 minutes, then HTTP 429
Wrong codes at /connect10 per address in 10 minutes, then HTTP 429
Default request body limit1 MiB
Request body at /mcp and /companion/results16 MiB
Request body at /companion/emit16,640 bytes
Request body at /auth/setup1,024 bytes
Turns per agent conversation200

The bearer key limit applies to valid keys from the same address too. SwB returns HTTP 429 on the affected endpoints until the limit clears.

SwB pauses a conversation at the turn limit. It records the pause in the audit log. If Slack is active, it sends the owner a direct message.

The Capy block can return the earlier conversation for the same task and target. Set the time window with blocks.capy.duplicate_window_s. The default is 600 seconds.

Client addresses

SwB uses the connection address for limits and audit records by default. Add your proxy to trusted_proxies or SWB_TRUSTED_PROXIES. SwB then uses the client address the proxy sends. Configure the proxy to set client address headers from a source it verifies.

Use the self-hosting guide to add a Cloudflare Tunnel connector or a reverse proxy on your Docker network.

Audit log

SwB records tool calls that its access rules reject. It records failed browser sign-ins for setup codes, used, expired or invalid links, passkeys, CSRF checks and OIDC.

SwB records missing or invalid GitHub webhook signatures. It limits repeated rows for some browser failures and for webhook refusals. Failure rows give the reason and keep codes, tokens and signatures private.

The SwB page shows records under Audit. Run swb log to print the recent records. Mailbox sends have the action send. See Channel modes for records of dropped deliveries.

Report a problem

Report security problems privately through GitHub Security Advisories for SwB.

On this page