How Setu protects tokens
Setu holds access tokens for other people's accounts, so this page lists what is done, where, and what is not done yet.
Storage#
- Each token is encrypted with AES-256-GCM under its own random data key.
- The data key is wrapped by a master key supplied through a key-provider interface. Today the key comes from the environment (a secret you control); an AWS KMS provider is added behind the same interface when Setu moves to AWS.
- Ciphertext is bound to its connection and kind (
connectionId|kind). Copying a ciphertext onto another row makes decryption fail. - Rotating the master key re-wraps data keys without asking users to reconnect.
- Tokens are decrypted in memory for one call and never written to logs, errors or the execution record.
Sign-in flow#
- OAuth
statevalues are random, single-use, stored as a hash, and expire after 10 minutes. - PKCE (S256) is used wherever the provider supports it.
- Your
redirect_urlmust be on the project's allow-list, so the callback cannot be used as an open redirect. - Provider error bodies are not echoed back to callers.
In transit#
- Browsers and apps reach Setu over HTTPS only. Responses carry HSTS, so browsers refuse to downgrade to HTTP.
- Setu reaches the database over TLS with the server certificate verified. A URL cannot weaken this; a plain
connection to another host is refused unless
SETU_DB_SSL=offis set on purpose, for a private network. - Setu reaches every app over HTTPS with certificate checks, and does not follow redirects.
- Tokens are never placed in URLs that Setu logs or returns, and are never sent to the model.
Outbound requests#
- An integration may only call the HTTPS host it declares.
- Hostnames are resolved and rejected if they point to private, loopback or link-local addresses, which blocks DNS rebinding and server-side request forgery.
- Path and body templates insert values as data; they cannot add path segments or pollute object prototypes.
- Responses are size-capped and requests time out.
What is stored, and how#
| Secret | At rest |
|---|---|
| Provider access and refresh tokens | AES-256-GCM, per-token key, bound to the connection |
| Approval inputs and digital worker run data | Encrypted with the same vault |
| Your personal MCP URL | Only a SHA-256 hash is used to look it up; a separate encrypted copy lets your dashboard show it again |
| API keys, sign-in sessions, email and reset links, webhook addresses, OAuth state | SHA-256 hash only; the original is shown once |
| Passwords | scrypt hashes |
Tenancy and access#
- API keys are stored as SHA-256 hashes; the full key is shown once.
- Every database query takes the project id, and cross-tenant reads are covered by tests.
- Per-key rate limits and monthly quotas protect shared OAuth apps from abuse.
- Per-address limits run before any database lookup, and the edge rejects floods before they reach the service.
- Request bodies are capped, NUL bytes and malformed requests are refused, and every query passes values as bound parameters. A test fails the build if a query is ever assembled from text.
Known limits#
- There has been no third-party security audit.
- PKCE verifiers sit in the state table as short-lived plaintext (10-minute TTL, deleted on use).
- The token-refresh lock and the rate limiter are per process, so a multi-instance deployment may refresh a token twice.
Report a vulnerability to [email protected]. We acknowledge within 3 business days and coordinate disclosure within 90 days. Include the steps to reproduce and any request ids.