Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion content/(account)/api-keys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Your own browser session has no stored policy. Spacefast compiles one per team f
|---|---|
| `owner` | Every action (`*`) |
| `admin` | Every action (`*`) |
| `member` | A fixed list: read, create, update, rename, and publish spaces; read, promote, and download versions; read, attach, and verify domains; read, trigger, and create builds; read the team; read billing |
| `member` | A fixed list: read, create, update, rename, and publish spaces; read, promote, and download versions; read, attach, and verify domains; read, trigger, and create builds; read and run team connectors (`connectors:read`, `connectors:execute`); read the team; read billing |

Two rules follow from that:

Expand All @@ -78,6 +78,18 @@ Two rules follow from that:

Keys created through the API can also be scoped to a single Space instead of the whole team, which narrows the policy to exactly that Space.

## Limit connector access

By default, a key with connector scopes (such as `team_admin`) can reach every team connection. Narrow it to specific connections when an integration should only touch one account:

```bash
sf api-keys create --name linear-bot --preset team_admin --connection cxn_abc123
sf api-keys update key_0123456789abcdef --connection cxn_abc123 --connection cxn_def456
sf api-keys update key_0123456789abcdef --all-connections
```

Over the API, pass `connectorAccess: { connectionIds: ["cxn_abc123"] }` on `POST /v1/api-keys` or `PATCH /v1/api-keys/{apiKeyId}`, or `connectorAccess: null` to remove the limit. For OAuth apps and CLI logins, choose specific connections under **Choose Connections** on the consent screen, or edit them later on **Connected apps**. See [Connectors](/connectors).

## What an agent grant cannot do

Some actions are reserved for a signed-in person, at every permission level. No API key, agent grant, or OAuth token can do them:
Expand Down
2 changes: 2 additions & 0 deletions content/(concepts)/teams.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Things that catch people out:

On **Members**, each row has role and removal actions for owners and admins. Removing someone takes away their access to the team and every Space in it. Anything they published stays where it is, and you can invite them back later.

If the team uses [Connectors](/connectors), the removal review lists the departing member's connector dependencies. Their personal connections disconnect automatically along with any Space bindings pointing to them. Team connections they created stay active while their existing Space bindings stay in place; if an owner or admin rebinds a role on a public, link-shared, or password-protected Space, restore its public-serving allowance before expecting calls to succeed.

Two guards you cannot talk your way past:

- The last owner cannot be removed, and cannot be demoted. Add another owner first.
Expand Down
385 changes: 156 additions & 229 deletions content/(dynamic)/connectors.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content/(dynamic)/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Outbound requests from a worker leave from Cloudflare's shared network addresses

`env` carries the space's environment variables. See [Environment variables](/environment-variables) for how to set them.

`env.CONNECTORS` calls your Space's [connector roles](/connectors#call-it-from-functions) when the version declares any.
`env.CONNECTORS` calls your Space's [connector roles](/space-connectors#call-it-from-functions) when the version declares any.

`env.DB` is always there. It is D1-shaped, so `env.DB.prepare(sql).bind(...).all()` is the call you already know. It reaches the space's own database through a broker, so no connection string ever lands in the bundle.

Expand Down
2 changes: 1 addition & 1 deletion content/(dynamic)/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export default defineMeta({
title: "Dynamic",
collapsed: false,
order: 5,
pages: ["zero-runtime", "functions", "connectors", "team-connectors", "database", "environment-variables", "crons", "object-storage", "logs", "wordpress"],
pages: ["zero-runtime", "functions", "connectors", "space-connectors", "database", "environment-variables", "crons", "object-storage", "logs", "wordpress"],
});
307 changes: 307 additions & 0 deletions content/(dynamic)/space-connectors.mdx

Large diffs are not rendered by default.

201 changes: 0 additions & 201 deletions content/(dynamic)/team-connectors.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion content/(reference)/config-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ The project config is the only writer. See [Crons](/crons) for the schedule gram
| --- | --- | --- | --- |
| `connectors` | object, up to 32 roles | none | Connector roles your pages call at `/__spacefast/connectors/<role>/<tool>` |

See [Connectors](/connectors) for each role's keys.
See [Connectors in Spaces](/space-connectors) for each role's keys.

<a id="access" />

Expand Down
5 changes: 3 additions & 2 deletions content/api/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ const created = await client.post("/v1/api-keys", {
| `ipAllowlist` | up to 100 strings, each ≤ 255 chars | Restrict the key to these addresses. Optional, nullable. |
| `expiresAt` | ISO 8601 | When the key stops working. Optional, nullable. Omit for no expiry. |
| `notBefore` | ISO 8601 | When the key starts working. Optional, nullable. |
| `connectorAccess` | `{ connectionIds: string[] }` or `null` | Limit the key to specific connector connections (`cxn_…`). Omit or pass `null` to allow every team connection. |

Three rules the code enforces:

- **The secret appears once.** `POST /v1/api-keys` is the only response carrying `secret`. Every other API-key response carries `secretPreview` (first 8 characters, then the last 4).
- **A key can never exceed its creator.** The derived policy must be a subset of the calling credential's policy. A wider request fails with `policy_exceeds_grantor`.
- **Secrets are immutable.** There is no rotate-in-place. Create a new key, move traffic, then revoke the old one with `DELETE /v1/api-keys/{apiKeyId}`. That returns `204` and keeps the record for audit.

`PATCH /v1/api-keys/{apiKeyId}` changes name, scope, permissions, allowlist, and expiry. `scope` and `permissions` must be sent together or both omitted.
`PATCH /v1/api-keys/{apiKeyId}` changes name, scope, permissions, allowlist, expiry, and `connectorAccess`. `scope` and `permissions` must be sent together or both omitted.

In the dashboard, keys live on the team's **Agents** page under **API keys**. The create form asks for **Name**, a **Policy preset**, and an optional **Expires**, then shows the secret once behind **Copy this key now. It won't be shown again.**

Expand Down Expand Up @@ -115,7 +116,7 @@ Creating, rotating, and revoking a machine credential all need an API key or a s

## Sessions and OAuth

A signed-in browser session works as a cookie and as `Authorization: Bearer <session token>`. A session has no stored policy. It compiles one per team from the caller's live role, so an owner or admin gets everything the team can do and a member gets read, create, write, rename, publish, promote, download, and build actions.
A signed-in browser session works as a cookie and as `Authorization: Bearer <session token>`. A session has no stored policy. It compiles one per team from the caller's live role, so an owner or admin gets everything the team can do and a member gets read, create, write, rename, publish, promote, download, build, and connector read/execute actions.

For third-party apps, Spacefast is an OAuth 2.0 authorization server.

Expand Down
Loading
Loading