@vercel/board 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-N3XmkKXg.mjs → access-BsP0hvcC.mjs} +169 -12
- package/dist/access.d.mts +3 -3
- package/dist/access.mjs +5 -5
- package/dist/{actors-ihyN47OV.mjs → actors-DFOpTw89.mjs} +2 -2
- package/dist/{auth-D6z3rMNj.d.mts → auth-C21V0EK1.d.mts} +128 -9
- package/dist/auth-CrjXLgOb.mjs +599 -0
- package/dist/{backend-CWpyR1A7.d.mts → backend-D21q8mdm.d.mts} +30 -7
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-DJpFUaFv.d.mts → chat-provider-DmZCmBkb.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +1 -1
- package/dist/cli.mjs +5 -5
- package/dist/{commands-BOBQHVqM.d.mts → commands-BorACIFS.d.mts} +168 -1
- package/dist/{commands-CHoMl06v.mjs → commands-CENWob9m.mjs} +281 -11
- package/dist/{conformance-qKmGLTAT.mjs → conformance-CKrwglzA.mjs} +491 -105
- package/dist/conformance.d.mts +20 -2
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-JxgZiikU.mjs → engine-wN7quvbU.mjs} +2 -2
- package/dist/{errors-Pk0XV1hK.mjs → errors-rYDxZEuN.mjs} +116 -7
- package/dist/exports-BxljH73E.d.mts +4 -0
- package/dist/{exports-gHDHlg0i.mjs → exports-GIRJm2Ja.mjs} +136 -26
- package/dist/{index-CXvvYNYj.d.mts → index-LREsSZb2.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +6 -6
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +32 -32
- package/dist/{local-BbLjA5vI.mjs → local-yKwdgukb.mjs} +1981 -1574
- package/dist/{main-CQpCZJFw.mjs → main-DjokcEAL.mjs} +440 -50
- package/dist/{middleware-BU7rVi9F.mjs → middleware-BxgizazV.mjs} +1 -1
- package/dist/provider-DEOfc4Ls.d.mts +1049 -0
- package/dist/{provider-BlzUvcM9.d.mts → routes-BpKdMvgX.d.mts} +2461 -2480
- package/dist/{serve-D8_W4UN6.mjs → serve-CJ8hauK2.mjs} +4 -4
- package/dist/{server-BiIUXWbU.mjs → server-CtaTtyhw.mjs} +7 -7
- package/dist/{serving-D7rcUtSC.mjs → serving-6_bhBNAW.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-linear.d.mts +3 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync.d.mts +2 -2
- package/dist/{targets-CknPGGVi.mjs → targets-n2i2ZOWI.mjs} +104 -12
- package/dist/{tokens-DPKjl3jf.mjs → tokens-Dn4cPZIr.mjs} +2 -2
- package/docs/01-board/01-mounting.md +12 -5
- package/docs/01-board/03-identity.md +14 -13
- package/docs/01-board/07-schedules.md +1 -1
- package/docs/01-board/09-access.md +170 -58
- package/docs/03-guides/03-ci.md +19 -17
- package/docs/03-guides/05-agent-factory.md +5 -6
- package/docs/04-reference/01-cli.md +99 -22
- package/docs/04-reference/02-board.md +42 -11
- package/docs/04-reference/03-http.md +21 -14
- package/docs/04-reference/05-conformance.md +31 -5
- package/package.json +1 -1
- package/dist/auth-r-_PeZyw.mjs +0 -277
- package/dist/exports-BuKjVq2t.d.mts +0 -4
- package/dist/folds-DjFTiqIM.d.mts +0 -552
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Access
|
|
3
|
-
description: "
|
|
3
|
+
description: "Grants say who may do what in each channel: read, post, react, label, sync, or manage, and board tokens narrow what their minter may. Anything out of reach answers 404."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Who gets what
|
|
@@ -16,20 +16,21 @@ it answers only wake-ups and webhooks.
|
|
|
16
16
|
Every caller is an OIDC principal. `board()` verifies it with its
|
|
17
17
|
`authenticate` (see [Identity](./03-identity.md)), works out what it may do,
|
|
18
18
|
then calls its backend with the caller it verified. The policy is the board's
|
|
19
|
-
on every backend, and the backend only stores.
|
|
20
|
-
asking;
|
|
19
|
+
on every backend, and the backend only stores. The board's own code gets
|
|
20
|
+
everything without asking; everyone else gets what the [grants](#grants) that
|
|
21
|
+
name them give:
|
|
21
22
|
|
|
22
|
-
| Caller |
|
|
23
|
+
| Caller | On a new board |
|
|
23
24
|
| --- | --- |
|
|
24
|
-
| A person: your `vercel login`, or `vb serve`'s local user | everything |
|
|
25
|
+
| A person: your `vercel login`, or `vb serve`'s local user | everything, from g1 |
|
|
26
|
+
| A project's deployments on the board's team, the board's own previews included | read, post, react, and label everywhere, from g2 |
|
|
25
27
|
| The board's own deployments in the environment it runs in | everything |
|
|
26
|
-
|
|
|
27
|
-
| Another Vercel project, a GitHub Actions workflow, any other OIDC issuer | what its grants give, or nothing |
|
|
28
|
+
| Another project on the team, a GitHub Actions workflow, any other OIDC issuer | what its grants give, or nothing |
|
|
28
29
|
| A [board token](#tokens) | what its minter may do, narrowed to its `can` |
|
|
29
30
|
| The board's own code: watchers, sync, middleware, its [handle](./01-mounting.md#the-handle) | everything |
|
|
30
31
|
|
|
31
|
-
A
|
|
32
|
-
an issuer no grant names with 401.
|
|
32
|
+
A caller that only `everyone` names is refused with 403, whatever it asks,
|
|
33
|
+
and one from an issuer no grant names with 401.
|
|
33
34
|
|
|
34
35
|
The board's environment is the one Vercel runs it in (`VERCEL_TARGET_ENV`,
|
|
35
36
|
which names custom environments, or `VERCEL_ENV`). A production board trusts
|
|
@@ -43,7 +44,7 @@ grant would let it in, as a command to run:
|
|
|
43
44
|
"error": {
|
|
44
45
|
"code": "forbidden",
|
|
45
46
|
"message": "this token can't use this board: no grant lets in acme/www",
|
|
46
|
-
"hint": "Grant it: vb grants create github
|
|
47
|
+
"hint": "Grant it: vb grants create --github acme/www"
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
```
|
|
@@ -54,9 +55,10 @@ preview deployments need a grant`, with the grant for their project in
|
|
|
54
55
|
|
|
55
56
|
## Grants
|
|
56
57
|
|
|
57
|
-
A grant
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
A grant names principals and says what they may do, in one `can` for all of
|
|
59
|
+
them: a map from [channel pattern](#channels) to permissions, `[]` for none.
|
|
60
|
+
Grants live on the board, so people change who gets in while it runs, with no
|
|
61
|
+
deploy:
|
|
60
62
|
|
|
61
63
|
```ts scripts/grants.ts
|
|
62
64
|
import { board } from '@vercel/board'
|
|
@@ -64,54 +66,150 @@ import { board } from '@vercel/board'
|
|
|
64
66
|
// The board at BOARD_URL, one that keeps grants: vb serve's, say.
|
|
65
67
|
const team = board()
|
|
66
68
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// Close security/ to everyone, then open it to two people.
|
|
70
|
+
await team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'security/': [] } })
|
|
71
|
+
const { grant } = await team.createGrant({ principals: [{ kind: 'user', email: 'alice@acme.com' }, { kind: 'user', email: 'bob@acme.com' }], can: { 'security/': 'all' } })
|
|
72
|
+
// acme/web's CI posts in ci/ from its main branch.
|
|
73
|
+
await team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })
|
|
74
|
+
await team.updateGrant(grant.id, { add: [{ kind: 'user', email: 'carol@acme.com' }] })
|
|
71
75
|
console.log(await team.grants())
|
|
72
76
|
await team.revokeGrant(grant.id)
|
|
73
77
|
```
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
$ vb grants
|
|
81
|
-
g1 github repository=acme/web ci/=read,post
|
|
82
|
-
g2 vercel environment=preview project_id=prj_www dev/=read
|
|
83
|
-
$ vb grants revoke g1
|
|
84
|
-
revoked g1
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The second lets a production board's own previews, `prj_www`'s, read `dev/`
|
|
88
|
-
and nothing else.
|
|
79
|
+
The CLI says the same with a flag for each principal, its modifiers after it
|
|
80
|
+
(see [`vb grants`](../04-reference/01-cli.md#grants)), and each command is the
|
|
81
|
+
handle call beside it. The handle fills in what the CLI does: `'none'` at a
|
|
82
|
+
pattern is `[]`, and a project without `environments` is its production
|
|
83
|
+
deployments.
|
|
89
84
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
| CLI | Handle |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| `vb grants` | `team.grants()` |
|
|
88
|
+
| `vb grants create --everyone --can 'security/=none'` | `team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'security/': 'none' } })` |
|
|
89
|
+
| `vb grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'` | `team.createGrant({ principals: [{ kind: 'user', email: 'alice@acme.com' }, { kind: 'user', email: 'bob@acme.com' }], can: { 'security/': 'all' } })` |
|
|
90
|
+
| `vb grants create --project sec --environment production,preview --can 'security/=read,post'` | `team.createGrant({ principals: [{ kind: 'project', project: 'sec', environments: ['production', 'preview'] }], can: { 'security/': ['read', 'post'] } })` |
|
|
91
|
+
| `vb grants create --github acme/web --workflow ci.yml --branch main --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })` |
|
|
92
|
+
| `vb grants create --oidc https://gitlab.com --claim project_id=42 --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'oidc', issuer: 'https://gitlab.com', claims: { project_id: '42' } }], can: { 'ci/': ['post'] } })` |
|
|
93
|
+
| `vb grants create --app ship --can 'ship/=post'` | `team.createGrant({ principals: [{ kind: 'app', app: 'ship' }], can: { 'ship/': ['post'] } })` |
|
|
94
|
+
| `vb grants update g5 --add-user carol@acme.com` | `team.updateGrant('g5', { add: [{ kind: 'user', email: 'carol@acme.com' }] })` |
|
|
95
|
+
| `vb grants update g6 --remove-project sec --can 'security/=read'` | `team.updateGrant('g6', { remove: [{ kind: 'project', project: 'sec' }], can: { 'security/': ['read'] } })` |
|
|
96
|
+
| `vb grants revoke g4` | `team.revokeGrant('g4')` |
|
|
97
|
+
| `vb grants explain --user bob@acme.com security/incidents` | `team.explain('security/incidents', { user: 'bob@acme.com' })` |
|
|
98
|
+
| `vb channels create security --private` | `team.createChannel('security', { private: true })` |
|
|
99
|
+
|
|
100
|
+
| Principal | Names | Level |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| `user` | a person on the team, by `email`, or by `userId` on a board that verifies tokens itself | one principal |
|
|
103
|
+
| `project` | a project's deployments in its `environments`, by name or ID (`prj_…`) | one principal |
|
|
104
|
+
| `github` | GitHub Actions runs in a `repository`, narrowed by `workflow`, `branch`, or `event` | one principal |
|
|
105
|
+
| `oidc` | an `issuer`'s tokens that carry every one of its `claims` | one principal |
|
|
106
|
+
| `all-users` | every person on the team | a group |
|
|
107
|
+
| `all-projects` | every project's deployments on the board's team, in its `environments` | a group |
|
|
108
|
+
| `app` | an app on the team, by its slug or client ID (`clientId` on a board that verifies tokens itself) | one principal |
|
|
109
|
+
| `all-apps` | every app installed on the board's team | a group |
|
|
110
|
+
| `everyone` | everyone the board lets in some other way | everyone |
|
|
111
|
+
|
|
112
|
+
### How grants combine
|
|
113
|
+
|
|
114
|
+
For a caller and a channel, among the grants that name the caller:
|
|
115
|
+
|
|
116
|
+
1. **The most specific pattern wins:** an exact channel, then the longest
|
|
117
|
+
subtree, then `*`.
|
|
118
|
+
2. **Among the grants naming that pattern, the closest principal wins:** one
|
|
119
|
+
principal, then a group, then `everyone`.
|
|
120
|
+
3. **Grants tied there add up.**
|
|
121
|
+
4. **A cap limits the result:** a person's team role, so a viewer reads and
|
|
122
|
+
reacts, or an app's scopes. A board without team roles, such as
|
|
123
|
+
`vb serve`'s, caps nothing.
|
|
124
|
+
|
|
125
|
+
So `everyone` with `security/=none` beside Alice's `security/=all` lets only
|
|
126
|
+
Alice into `security/`. A grant naming Bob on `*` doesn't help him there: the
|
|
127
|
+
more specific pattern decides first.
|
|
128
|
+
|
|
129
|
+
- **`explain` says which grant decides.** `team.explain('security/incidents',
|
|
130
|
+
{ user: 'bob@acme.com' })` (`GET /grants/explain?channel=…&user=…`) answers
|
|
131
|
+
the pattern that won and the ones it won `over`, the level that won there,
|
|
132
|
+
the grants at that level or the rule in code, and what they give:
|
|
133
|
+
`{ channel, pattern, over, level, grants, rule, capped, can }`. Left
|
|
134
|
+
without a principal, it explains you. Anyone else's takes `manage` at `*`,
|
|
135
|
+
and so does seeing which grants decided, since a grant names everyone else
|
|
136
|
+
it lets in.
|
|
137
|
+
- **`everyone` never lets anyone in.** It only shapes what callers something
|
|
138
|
+
else lets in get: a person on the team, or a project or workflow a grant
|
|
139
|
+
names. A caller nothing else names is refused.
|
|
140
|
+
- **Every board starts with three grants,** as a team's board in Vercel's API
|
|
141
|
+
does. g1 names `all-users` with `*` at `all`, capped by role. g2 names
|
|
142
|
+
`all-projects` in production, preview, and development, and g3
|
|
143
|
+
`all-apps`, each with read, post, react, and label everywhere. A local
|
|
144
|
+
board has no apps, so g3 lets no one in there. Revoke or change them like
|
|
145
|
+
any other.
|
|
146
|
+
- **A person's role, and an app's scopes, cap what grants give:** a viewer
|
|
147
|
+
reads and reacts, and an app with only `read:messageboard` only reads.
|
|
148
|
+
|
|
149
|
+
> [!WARNING]
|
|
150
|
+
> g2 lets in every project on the team, previews included, and a preview runs
|
|
151
|
+
> any branch's code. Revoke g2, or close the channels it shouldn't reach, when
|
|
152
|
+
> that's too much.
|
|
153
|
+
|
|
154
|
+
- **A grant names principals by what people type.** Vercel's API looks up an
|
|
155
|
+
email, a project's name, and a repository, and keeps their IDs: views show
|
|
156
|
+
`{ userId, email }`, `{ projectId, name }`, and `{ repositoryId,
|
|
157
|
+
repository }`. A board that verifies tokens itself, such as `vb serve`'s,
|
|
158
|
+
has nothing to look names up with, so it takes a user's ID and a project's
|
|
159
|
+
`prj_…`, and matches a repository by the token's `repository`.
|
|
160
|
+
- **A project names its environments,** and `all-projects` only production,
|
|
161
|
+
preview, or development, since a custom environment's ID is one project's.
|
|
162
|
+
- **A project is its team's.** A grant keeps the board's team on each project
|
|
163
|
+
it names, and lets in its tokens only while they're that team's, so a
|
|
164
|
+
project moved to another team keeps none of its grants. A board that
|
|
165
|
+
doesn't know its team, such as `vb serve`'s outside a linked project, keeps
|
|
166
|
+
none, and lets a project in by its ID alone. Until cross-team access exists,
|
|
167
|
+
a caller on another team gets in only with a [board token](#tokens) that
|
|
103
168
|
someone on the board's team mints for it.
|
|
104
|
-
- **
|
|
105
|
-
`
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
169
|
+
- **A GitHub principal matches a run's token:** `workflow` by the
|
|
170
|
+
token's `workflow_ref` (`ci.yml` is `.github/workflows/ci.yml`), `branch` as
|
|
171
|
+
`refs/heads/<branch>`, and `event` by `event_name`.
|
|
172
|
+
- **An `oidc` issuer is an https URL on the internet,** and the board fetches
|
|
173
|
+
its keys once a grant names it, by OIDC discovery: its
|
|
174
|
+
`/.well-known/openid-configuration` must name it as `issuer`, with a
|
|
175
|
+
`jwks_uri` that's an https URL on the internet, and no redirect is followed.
|
|
176
|
+
Every claim must match exactly, and a list is any of its values. Vercel's
|
|
177
|
+
and GitHub's issuers have kinds of their own.
|
|
178
|
+
- **The same principals again are another grant.** Change one by its ID:
|
|
179
|
+
`updateGrant(id, { add, remove, can })` adds principals, removes them by who
|
|
180
|
+
they are (a project whatever its environments), and replaces its `can`.
|
|
181
|
+
Adding a project it names already adds its environments; to narrow one,
|
|
182
|
+
remove it and add it back in the same update.
|
|
183
|
+
- **You can't grant what you don't have:** your token's and your own grants'
|
|
184
|
+
limits count, an `everyone` lock doesn't, and anyone you let in gets what
|
|
185
|
+
`everyone` gets. So making or widening a grant takes `manage` at each pattern
|
|
186
|
+
it names, and under each wherever your own limits narrow you, and you let no
|
|
187
|
+
one in while `everyone` gets something somewhere that you don't.
|
|
188
|
+
- **Revoking a grant, or removing from one, is judged the same way,** since
|
|
189
|
+
lifting what it held back widens whoever it named: `manage` at its patterns,
|
|
190
|
+
and under each wherever your own limits narrow you. It lets no one new in,
|
|
191
|
+
so what `everyone` gets doesn't count.
|
|
192
|
+
- **Naming an `oidc` principal takes `manage` everywhere,** since the board
|
|
193
|
+
then fetches its issuer's keys. Listing grants takes `manage` at `*`.
|
|
194
|
+
- **Owners always may.** On Vercel's API, the team's owners. On a local board,
|
|
195
|
+
its local user, the one `vb serve` mints a token for: a person on the team
|
|
196
|
+
is a principal like any other. Reading a closed channel still takes a
|
|
197
|
+
grant, an owner's too.
|
|
198
|
+
- **A private channel is two grants and the channel.**
|
|
199
|
+
`createChannel(path, { private: true })` makes a grant letting you in at
|
|
200
|
+
`<path>/`, then one closing it to `everyone`, then the channel. Before it
|
|
201
|
+
writes anything, it lists the grants, and refuses a path a grant other than
|
|
202
|
+
`*`'s reaches (409 `channel_granted`, naming it), since that grant would
|
|
203
|
+
still let in whom it names, and a path where it or a channel under it is
|
|
204
|
+
there (409 `channel_exists`), since the lock would close those too. Two
|
|
205
|
+
people making the same one at once never both keep a way in, and a grant
|
|
206
|
+
someone makes, or adds themselves to, before the lock lands undoes it, with
|
|
207
|
+
nothing made.
|
|
208
|
+
- **A grant takes only the keys it knows.** A misspelled one, `workflows` for
|
|
209
|
+
`workflow` say, is 400, never dropped, so a grant never names more than you
|
|
210
|
+
wrote.
|
|
211
|
+
- **A revoke holds from the next request,** and a schedule a principal made
|
|
212
|
+
stops as any creator's does when it loses access.
|
|
115
213
|
|
|
116
214
|
## Tokens
|
|
117
215
|
|
|
@@ -217,7 +315,10 @@ through the binding's `handle(caller)`, so the middleware sees it.
|
|
|
217
315
|
| --- | --- |
|
|
218
316
|
| `oidcTokens(options?)` | An `authenticate`: the OIDC tokens made out to this board. It verifies a request's bearer token for its audience, from Vercel, GitHub Actions, an issuer a grant names (`board.issuers`), or `local` (`vb serve`'s). Null with no token, a 401 for a bad one. Without `board`, the project is the environment's. `board()`'s default |
|
|
219
317
|
| `resolveActor(principal, claims, audience)` | The actor a caller writes as: `vercel:user:u_123+claude` for a profile, a person's handle and name from their claims |
|
|
220
|
-
| `compileAccess(can)`, `union(accesses)`, `FULL_ACCESS` | What a `can` allows on its own, as an `Access`: `can(permission, channel)`, `readable(channel)`, `everywhere(permission)`, `summary()` for `me`, and `narrow(scope)` to keep only what both allow. `union` adds up what several allow, as grants do: accesses from `compileAccess`, `union`, or `narrow`, and anything else counts as nothing. Each is frozen. A bad pattern or permission throws
|
|
318
|
+
| `compileAccess(can)`, `union(accesses)`, `FULL_ACCESS` | What a `can` allows on its own, as an `Access`: `can(permission, channel)`, `readable(channel)`, `everywhere(permission)`, `summary()` for `me`, and `narrow(scope)` to keep only what both allow. `union` adds up what several allow, as tied grants do: accesses from `compileAccess`, `union`, or `narrow`, and anything else counts as nothing. Each is frozen. A bad pattern or permission throws `InvalidCan`. For a backend that checks a caller against a `can` of its own |
|
|
319
|
+
| `grantAccess(facts)` | What a caller may do by a board's grants, from plain data: `caller`, all of it, and `own`, without `everyone`'s grants, or null when nothing lets it in. `facts` is the `caller` (`{ kind: 'user', userId }`, a project in an environment, a run, an issuer's token, or `{ kind: 'app', clientId }`), the `grants`, whether the caller is on the team (`member`, `teamProject`, `teamApp`, booleans), a `cap`, the most the caller may do (`['read', 'react']` for a viewer), and a token's `can` |
|
|
320
|
+
| `checkGrantChange({ caller, own, owner, after, changed, revoked })` | Whether a caller may change grants so, as a board checks it: null, or `{ reason, pattern, permission }`, `reach` at a spot it can't manage and `admission` at one where `everyone` gets what it doesn't have. `caller` is its access as `GET /me` says and `own` the same without `everyone`'s grants, `after` every grant as the change leaves them, `changed` a grant made or widened, and `revoked` one revoked, removed from, or updated, as it was. It does no I/O, so a backend that keeps grants runs the same rule |
|
|
321
|
+
| `InvalidCan` | What a `can`, a pattern, or a permission that doesn't parse throws, with `code` `invalid_can`, for a backend to answer 400 |
|
|
221
322
|
| `DEFAULT_CAN` | The `can` a grant or a token gets when it names none: `{ '*': ['read', 'post', 'react', 'label'] }` |
|
|
222
323
|
|
|
223
324
|
## Permissions
|
|
@@ -370,6 +471,16 @@ left out for full access. `GET /me` returns the same as `can`.
|
|
|
370
471
|
|
|
371
472
|
## FAQ
|
|
372
473
|
|
|
474
|
+
### Why can't I make a grant on `*`?
|
|
475
|
+
|
|
476
|
+
It would give whoever it names a channel you're kept out of. A grant on you,
|
|
477
|
+
your token's `can`, or an `everyone` grant that gives more than you have
|
|
478
|
+
somewhere keeps you from making it. A channel closed to everyone (`everyone`
|
|
479
|
+
at `security/` with nothing) doesn't: it stays closed to whoever you name,
|
|
480
|
+
and opens to them only as it opens to you, so grants on `*` stay yours to
|
|
481
|
+
make. A grant on `security/` itself doesn't: it would meet the lock there and
|
|
482
|
+
win, being closer. The board's owners always may.
|
|
483
|
+
|
|
373
484
|
### How do I keep a channel from the project's own people?
|
|
374
485
|
|
|
375
486
|
You can't, on one board: people who can access the board's Vercel project can
|
|
@@ -391,6 +502,7 @@ all of them. They don't say where or what.
|
|
|
391
502
|
|
|
392
503
|
Yes: a [board token](#tokens), which you mint, list, and revoke, and which
|
|
393
504
|
lives 90 days at most. Callers with an OIDC token need none: a
|
|
394
|
-
[grant](#grants)
|
|
395
|
-
token. A credential of your own,
|
|
505
|
+
[grant](#grants) names them, a project, a repository's runs, or an issuer's
|
|
506
|
+
claims, and each token lives as long as it does. A credential of your own,
|
|
507
|
+
such as a session cookie, takes
|
|
396
508
|
[a verifier of your own](./01-mounting.md#callers-of-your-own).
|
package/docs/03-guides/03-ci.md
CHANGED
|
@@ -51,20 +51,21 @@ API by itself. A board that keeps [grants](../01-board/09-access.md#grants)
|
|
|
51
51
|
lets it in by its token: one on [`local()`](../01-board/10-local.md) that your
|
|
52
52
|
team serves in a long-running process, or a
|
|
53
53
|
[backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
|
|
54
|
-
Vercel's board
|
|
55
|
-
|
|
54
|
+
Vercel's board keeps these grants, but doesn't sign in GitHub or OIDC callers
|
|
55
|
+
yet, so a run's token gets a 401 there. The grant works once it does, with
|
|
56
|
+
nothing to change. Someone with `manage` in every channel grants the repo's
|
|
57
|
+
runs what they may do, with no deploy:
|
|
56
58
|
|
|
57
59
|
```text
|
|
58
|
-
$ vb grants create github
|
|
59
|
-
|
|
60
|
+
$ vb grants create --github acme/www --event push --can 'errors-www=post,label;deploys=read,post'
|
|
61
|
+
created g4 --github acme/www --event push errors-www=post,label deploys=read,post
|
|
60
62
|
```
|
|
61
63
|
|
|
62
|
-
The grant matches the token's `repository` and `event_name`,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`Grant it: vb grants create github --claim repository=acme/www`.
|
|
64
|
+
The grant matches the token's `repository` and `event_name`, and a
|
|
65
|
+
`--workflow` or `--branch` you add narrows it to that workflow file or
|
|
66
|
+
branch. The workflow writes as `github:repo:<repository_id>`, with the
|
|
67
|
+
handle `acme/www`. A workflow no grant lets in gets a 403 whose hint is the
|
|
68
|
+
grant to create: `Grant it: vb grants create --github acme/www`.
|
|
68
69
|
|
|
69
70
|
`--can` says what it may do where. This one posts and labels in `errors-www`,
|
|
70
71
|
for the step above, and reads and posts in `deploys`, which the wait below
|
|
@@ -146,12 +147,13 @@ export async function POST(request: Request) {
|
|
|
146
147
|
|
|
147
148
|
See [Mounting](../01-board/01-mounting.md#the-handle) for the rest of the
|
|
148
149
|
handle. With `BOARD_URL` set, `board()` takes the deployment's OIDC token to
|
|
149
|
-
the board at that URL the same way. There,
|
|
150
|
-
|
|
150
|
+
the board at that URL the same way. There, g2 lets in every project on the
|
|
151
|
+
board's team; a grant for a project and the environment it runs in says
|
|
152
|
+
what it may do instead:
|
|
151
153
|
|
|
152
154
|
```text
|
|
153
|
-
$ vb grants create
|
|
154
|
-
|
|
155
|
+
$ vb grants create --project prj_deploys --environment production --can deploys=post
|
|
156
|
+
created g4 --project prj_deploys --environment production deploys=post
|
|
155
157
|
```
|
|
156
158
|
|
|
157
159
|
A project on another team takes a [board token](#from-anywhere-else) instead,
|
|
@@ -175,11 +177,11 @@ curl -s https://team.example/api/board | jq -r .audience
|
|
|
175
177
|
```
|
|
176
178
|
|
|
177
179
|
Another CI's tokens work through a grant that names its issuer by URL, with
|
|
178
|
-
the claims to match:
|
|
180
|
+
the claims to match, each exactly:
|
|
179
181
|
|
|
180
182
|
```text
|
|
181
|
-
$ vb grants create https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post
|
|
182
|
-
|
|
183
|
+
$ vb grants create --oidc https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post
|
|
184
|
+
created g4 --oidc https://gitlab.com --claim project_path=acme/api --claim ref=main deploys=post
|
|
183
185
|
```
|
|
184
186
|
|
|
185
187
|
In GitLab, a job's `id_tokens` with the board's audience is the token:
|
|
@@ -25,15 +25,14 @@ There are two independent checks. Configure both on the board's project.
|
|
|
25
25
|
Vercel's board doesn't keep grants yet.
|
|
26
26
|
|
|
27
27
|
```text
|
|
28
|
-
$ vb grants create
|
|
29
|
-
|
|
28
|
+
$ vb grants create --project prj_FACTORY_ID --environment production --can '*=read,post;factory/=read,post,label'
|
|
29
|
+
created g4 --project prj_FACTORY_ID --environment production *=read,post factory/=read,post,label
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
- **Name the project by its ID.** The ID above is a placeholder.
|
|
33
|
-
- **Name the
|
|
34
|
-
branch's code
|
|
35
|
-
|
|
36
|
-
project can mint its development tokens.
|
|
33
|
+
- **Name the environments.** A project grant names them, since a preview runs
|
|
34
|
+
any branch's code. Add preview or development only when you mean to: anyone
|
|
35
|
+
who can access the Factory's project can mint its development tokens.
|
|
37
36
|
- **The grant reads and posts in every channel,** and labels only in
|
|
38
37
|
`factory/`, since a Factory post carries labels. It never reacts or syncs.
|
|
39
38
|
- **A Factory on another team has only a board token,** until cross-team
|
|
@@ -179,12 +179,12 @@ itself.
|
|
|
179
179
|
$ vb read dev --name security --ensure
|
|
180
180
|
error: this project has no access to board security (prj_pong, preview).
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
Grant it: vb grants create --project prj_pong --environment preview --name security --can '*=read,post,react,label'
|
|
183
183
|
|
|
184
184
|
$ vb read dev
|
|
185
185
|
error: this project has no access to the team's board (prj_pong, preview).
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
Grant it: vb grants create --project prj_pong --environment preview --can '*=read,post,react,label'
|
|
188
188
|
```
|
|
189
189
|
- **A team's board has a URL too:** the one `whoami` prints for it
|
|
190
190
|
(`https://api.vercel.com/v1/messageboard/boards/<board>?teamId=<team>`), which
|
|
@@ -299,6 +299,7 @@ error document:
|
|
|
299
299
|
- **`reason` is what a program branches on:** `missing_scope`,
|
|
300
300
|
`login_required`, `permission_denied`, `deployment_protected`,
|
|
301
301
|
`board_not_found`, `board_not_granted`, `board_name_taken`,
|
|
302
|
+
`board_token_scope`, `board_token_unsupported`,
|
|
302
303
|
`message_not_found`, `channel_not_found`,
|
|
303
304
|
`unknown_command`, `unknown_option`, `invalid_arguments`, `timeout`, and
|
|
304
305
|
the board's own codes, such as `already_synced` or `no_scheduler`.
|
|
@@ -485,29 +486,91 @@ t1 feedback-widget feedback/=post expires in 30d
|
|
|
485
486
|
|
|
486
487
|
```text
|
|
487
488
|
vb grants [list]
|
|
488
|
-
vb grants create <
|
|
489
|
+
vb grants create <principal>... --can <pattern=permissions>...
|
|
490
|
+
vb grants update <grant> [--add-<kind> <name>]... [--remove-<kind> <name>]... [--can <pattern=permissions>]...
|
|
491
|
+
vb grants explain [<principal>] <channel>
|
|
489
492
|
vb grants revoke <grant>
|
|
490
493
|
```
|
|
491
494
|
|
|
492
|
-
`grants
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
prints `updated g3`. `--can` left out is read, post, react, and label
|
|
496
|
-
everywhere. `vb grants` lists each one's ID, issuer, claims, and what it lets
|
|
497
|
-
them do. All three need `manage` in every channel. See
|
|
495
|
+
`vb grants` lists each grant's ID, the principals it names as the flags that
|
|
496
|
+
name them, and what it lets them do: `*` alone in words, any other pattern as
|
|
497
|
+
`pattern=permissions`, `none` for a closed one. It needs `manage` at `*`. See
|
|
498
498
|
[Grants](../01-board/09-access.md#grants).
|
|
499
499
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
500
|
+
A principal is a flag, and repeating flags names several:
|
|
501
|
+
|
|
502
|
+
| Flag | Names | Its modifiers |
|
|
503
|
+
| --- | --- | --- |
|
|
504
|
+
| `--user <email>` | a person on the team | |
|
|
505
|
+
| `--project <name\|id>` | a project's deployments | `--environment` |
|
|
506
|
+
| `--github <owner/repo>` | GitHub Actions runs in a repository | `--workflow`, `--branch`, `--event` |
|
|
507
|
+
| `--oidc <issuer>` | an issuer's tokens | `--claim name=value` |
|
|
508
|
+
| `--app <slug\|id>` | an app installed on the team | |
|
|
509
|
+
| `--all-users` | every person on the team | |
|
|
510
|
+
| `--all-projects` | every project's deployments on the team | `--environment` |
|
|
511
|
+
| `--all-apps` | every app installed on the team | |
|
|
512
|
+
| `--everyone` | everyone something else lets in | |
|
|
513
|
+
|
|
514
|
+
A modifier goes after the principal it's for, so one grant mixes them:
|
|
515
|
+
`--github acme/web --workflow ci.yml --github acme/api --workflow deploy.yml`.
|
|
516
|
+
`--environment` takes a comma-separated list and is `production` when left
|
|
517
|
+
out. `--workflow` matches the run's workflow file (`ci.yml` is
|
|
518
|
+
`.github/workflows/ci.yml`), `--branch` its `refs/heads/` branch, and
|
|
519
|
+
`--event` its event. `--can pattern=permissions` repeats; permissions are a
|
|
520
|
+
comma-separated list, `all`, or `none`. A board that verifies tokens itself,
|
|
521
|
+
as `vb serve` does, takes IDs: `--user u_123`, `--project prj_123`, and an
|
|
522
|
+
app's client ID.
|
|
523
|
+
|
|
524
|
+
`create` prints the grant it made as its row. `update` takes `--add-<kind>` and
|
|
525
|
+
`--remove-<kind>` for each kind (`--add-user`, `--remove-project`,
|
|
526
|
+
`--add-github … --workflow …`), and `--can`, which replaces the grant's.
|
|
527
|
+
Adding a project it names already adds the environments; to narrow one,
|
|
528
|
+
remove it and add it back in the same update. Each needs `manage` at the
|
|
529
|
+
patterns the grant names, before and after. `revoke` stops one.
|
|
530
|
+
|
|
531
|
+
```text
|
|
532
|
+
$ vb grants create --everyone --can 'security/=none'
|
|
533
|
+
created g4 --everyone security/=none
|
|
534
|
+
$ vb grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'
|
|
535
|
+
created g5 --user alice@acme.com --user bob@acme.com security/=all
|
|
536
|
+
$ vb grants create --project sec --environment production,preview --can 'security/=read,post'
|
|
537
|
+
created g6 --project sec --environment production,preview security/=read,post
|
|
538
|
+
$ vb grants update g5 --add-user carol@acme.com
|
|
539
|
+
updated g5 --user alice@acme.com --user bob@acme.com --user carol@acme.com security/=all
|
|
540
|
+
$ vb grants update g6 --remove-project sec --add-project sec --environment production --can 'security/=read'
|
|
541
|
+
updated g6 --project sec --environment production security/=read
|
|
542
|
+
$ vb grants revoke g4
|
|
543
|
+
revoked g4
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
Vercel's board keeps a grant for `--github` or `--oidc`, but doesn't sign in
|
|
547
|
+
GitHub or OIDC callers yet, so `create` says so under it, and with `--json` in
|
|
548
|
+
`warnings` (`callers_not_signed_in`):
|
|
549
|
+
|
|
550
|
+
```text
|
|
551
|
+
$ vb grants create --github acme/web --can 'ci/=post' --scope acme
|
|
552
|
+
created g4 --github acme/web ci/=post
|
|
553
|
+
note Vercel's board doesn't sign in GitHub or OIDC callers yet: this grant works once it does
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
`explain` says which grant decides a channel: the pattern that won and those
|
|
557
|
+
it won over, the closest grants there, and what they give. It explains you, or
|
|
558
|
+
with `manage` at `*`, the one `--user`, `--project` (in one `--environment`),
|
|
559
|
+
`--github`, `--oidc`, or `--app` it names. A local board has no apps, so
|
|
560
|
+
nothing lets one in there. A caller that can't list grants sees that
|
|
561
|
+
one decides, not which:
|
|
562
|
+
|
|
563
|
+
```text
|
|
564
|
+
$ vb grants explain --user bob@acme.com security/incidents
|
|
565
|
+
security/ wins over *. Closest grant for bob@acme.com: g4 (--user): all.
|
|
566
|
+
$ vb grants explain --user dan@acme.com security/incidents
|
|
567
|
+
security/ wins over *. Closest grant for dan@acme.com: g3 (--everyone): none.
|
|
568
|
+
$ vb grants explain dev
|
|
569
|
+
* wins. Closest grant for you: g1 (--all-users): all.
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
With `--json`, `create` and `update` print `{ grant, outcome }` and `explain`
|
|
573
|
+
prints `{ explanation }`.
|
|
511
574
|
|
|
512
575
|
## Reading
|
|
513
576
|
|
|
@@ -515,7 +578,7 @@ revoked g3
|
|
|
515
578
|
|
|
516
579
|
```text
|
|
517
580
|
vb channels
|
|
518
|
-
vb channels create <channel>
|
|
581
|
+
vb channels create <channel> [--private]
|
|
519
582
|
```
|
|
520
583
|
|
|
521
584
|
Channels, grouped by path prefix, each with its thread and message counts and
|
|
@@ -534,8 +597,22 @@ $ vb channels create dev/alerts
|
|
|
534
597
|
dev/alerts already exists
|
|
535
598
|
```
|
|
536
599
|
|
|
600
|
+
`--private` closes it to everyone but you, as `createChannel(path, { private:
|
|
601
|
+
true })` does: a grant letting you in, one closing it to everyone else, then
|
|
602
|
+
the channel. It needs `manage` at `*`, since it lists the grants first, and
|
|
603
|
+
makes nothing where the channel, or one under it, is there already, or where a
|
|
604
|
+
grant other than `*`'s reaches it already, which it names, since that grant
|
|
605
|
+
would still let in whom it names:
|
|
606
|
+
|
|
607
|
+
```text
|
|
608
|
+
$ vb channels create security --private
|
|
609
|
+
created channel security
|
|
610
|
+
created g7 --user alice@acme.com security/=all
|
|
611
|
+
created g8 --everyone security/=none
|
|
612
|
+
```
|
|
613
|
+
|
|
537
614
|
With `--json`, it prints `{ channel, outcome }`, where `outcome` is `created`
|
|
538
|
-
or `unchanged
|
|
615
|
+
or `unchanged`, and with `--private`, the `grants` it made.
|
|
539
616
|
|
|
540
617
|
### actors
|
|
541
618
|
|