Layers of the boundary
Isolation is not a single check. It is enforced at four layers, so a bug in one layer does not open the boundary on its own:Identities
Three kinds of caller reach the core API, each over its own channel:- Users sign in to the console. Authentication is handled by better-auth: an httpOnly
sessioncookie (SameSite=Lax,Securebehind https), with the database as the source of truth and a short-lived Redis cache in front of it. Revoking a session writes a revocation marker so the cache can never resurrect it. - MCP clients send the workspace API key in the
x-oasm-api-keyheader. The key is accepted only on the MCP endpoint and maps the request to the key’s workspace. See API keys and MCP. - Workers never use a user session or the API key. They join with a single-use join key and then authenticate every gRPC call with their own worker token. See Worker and connector runtime.
user or admin. The role controls the administration area only; it does not grant access to anyone’s workspace data. Admin endpoints live under a separate /admin prefix, require the admin role, and additionally check the client IP against the admin IP allow-list when one is configured.
Sign-in protection
- Rate limiting — 100 requests per minute per client IP and path, with much stricter budgets on sign-in, sign-up and password changes. Counters live in Redis, so every API replica shares the same budget.
- Origin checks — cookie-carrying requests are accepted only from trusted origins (
BASE_URLandTRUSTED_ORIGINS), which also form the CORS allow-list for the API and the storage buckets. - Gated sign-up — public sign-up is off by default. When it is on, new accounts wait for admin approval. See Authentication.
The workspace permission check
Every workspace-scoped route declares the permission it needs, in the form<resource>.<action>, for example asset.read, target.write or workspace.apikey. Before the handler runs, a guard:
- resolves the workspace from the route or the
X-Workspace-Idheader, - loads the caller’s membership and the union of the permission keys of all their groups,
- passes the request only when the keys contain every required key (or the wildcard
*).
writeimpliesreadfor the same resource. Nothing else is implied.- Non-members get 403, never 404, and an id that is not a UUID is a 400. The response never reveals whether a workspace exists.
No privilege escalation
Permission groups are how access is delegated, so the platform makes sure delegation cannot grow access:- You can only grant permission keys — or assign groups — whose keys you already hold.
- The built-in Admin group (holding
*) is a system group: it cannot be edited, deleted or handed out by invitation. - You cannot change your own membership, the workspace owner’s, or that of any holder of a system group.
- Invitations go only to existing accounts, and the response returns counts only, so it does not reveal which email addresses have accounts.
Scoping inside the core API
The workspace id a service works with always comes from the permission check (or, for workers and agents, from their authenticated context). It is never taken from a request body. From there:- Tables that carry
workspaceIdfilter on it directly (targets, projects, issues, workflows, files). - Tables that do not are scoped through their parent. Jobs, for example, are scoped through asset → target → workspace.
- A lookup of another workspace’s id returns 404, so ids from one tenant are indistinguishable from ids that do not exist.
- User data returned by the API is limited to
id,nameandimage; email addresses and account fields are visible to platform admins only.
Scoping in the database
The attack surface tables — assets, services, HTTP responses and their TLS, technology, IP and status-code facets, DNS records, discovered URLs, tags and vulnerabilities — each carry their ownworkspaceId column. Three mechanisms keep it correct:
- Composite foreign keys. A child references its parent by
(parentId, workspaceId), and the parent is unique on(id, workspaceId). A service row whose workspace differs from its asset’s is rejected by Postgres. - Fill triggers. When a writer leaves the column empty, a
BEFORE INSERTtrigger copies it from the parent, so older code paths stay correct. - Row-level security. Queries from the Attack Surface Query engine run as a dedicated
asq_readerrole with the workspace set on the transaction. Row-level security policies on these tables then hide every row of other workspaces, even if a compiled query were wrong.
Scoping on the real-time stream
The console keeps one Server-Sent Events connection open (GET /events/stream) for live updates. Because any member can open it regardless of permissions, it follows two rules:
- Allowlist. Only a small set of event families (notifications, workers, targets, workflows) reach browsers. Every other event on the event bridge stays server-side.
- Ids only. A browser receives the event name, ids and time — never a payload. It then refetches through REST, which applies the permission check above.
Accountability
Membership, permission and configuration changes are recorded in the audit log. The audit table is append-only at the database level; see Secrets and encryption.Related
Secrets and encryption
How credentials are encrypted per workspace and released to workers
Permissions
Permission groups and the full list of permission keys
Data model
The tables the boundary protects
Attack Surface Query engine
How tenant scope is compiled into every query
