@vercel/board 0.32.0 → 0.33.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/README.md +25 -20
- package/dist/{access-CY5xVMIK.mjs → access-N3XmkKXg.mjs} +3 -3
- package/dist/access.d.mts +4 -5
- package/dist/access.mjs +5 -5
- package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
- package/dist/{auth-K8dY1nBY.d.mts → auth-D6z3rMNj.d.mts} +7 -93
- package/dist/{auth-8pRZnF1M.mjs → auth-r-_PeZyw.mjs} +32 -148
- package/dist/{backend-DxE9wGKm.d.mts → backend-CWpyR1A7.d.mts} +81 -51
- package/dist/backend-local.d.mts +28 -0
- package/dist/backend-local.mjs +2 -0
- package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
- package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.d.mts} +2 -3
- 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 +6 -6
- package/dist/{commands-CpyPV_tk.d.mts → commands-BOBQHVqM.d.mts} +9 -0
- package/dist/{commands-DsnQKTdB.mjs → commands-CHoMl06v.mjs} +12 -1
- package/dist/{conformance-3RBKxwbp.mjs → conformance-qKmGLTAT.mjs} +5 -5
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
- package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
- package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
- package/dist/exports-BuKjVq2t.d.mts +4 -0
- package/dist/exports-gHDHlg0i.mjs +3207 -0
- package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
- package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
- package/dist/index-CXvvYNYj.d.mts +11 -0
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +21 -8
- package/dist/index.node.d.mts +5 -6
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +95 -95
- package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
- package/dist/local-BbLjA5vI.mjs +8818 -0
- package/dist/{main-CcYDo9Hb.mjs → main-CQpCZJFw.mjs} +91 -23
- package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
- package/dist/middleware-BU7rVi9F.mjs +103 -0
- package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
- package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
- package/dist/{serve-Bplieh0C.mjs → serve-D8_W4UN6.mjs} +33 -24
- package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
- package/dist/{serving-Y7s7VDjB.mjs → serving-D7rcUtSC.mjs} +1 -1
- package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
- package/dist/sqlite-DCtZFEVm.mjs +30 -0
- package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
- package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
- package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
- package/dist/store-memory-OdGsc-t_.mjs +2 -0
- package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
- package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
- package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +2 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{watchers-hash-CurCzwhe.mjs → targets-CknPGGVi.mjs} +40 -10
- package/dist/{tokens-C7kYyrAG.mjs → tokens-DPKjl3jf.mjs} +15 -43
- package/docs/01-board/01-mounting.md +243 -288
- package/docs/01-board/03-identity.md +41 -50
- package/docs/01-board/04-messages.md +15 -14
- package/docs/01-board/05-reading.md +3 -3
- package/docs/01-board/06-watchers.md +58 -105
- package/docs/01-board/07-schedules.md +21 -41
- package/docs/01-board/08-middleware.md +11 -17
- package/docs/01-board/09-access.md +76 -313
- package/docs/01-board/10-local.md +81 -0
- package/docs/01-quickstart.md +49 -126
- package/docs/02-sync/01-overview.md +25 -80
- package/docs/02-sync/02-functions.md +10 -16
- package/docs/02-sync/03-slack.md +13 -26
- package/docs/02-sync/04-github.md +8 -20
- package/docs/02-sync/07-linear.md +6 -10
- package/docs/03-guides/02-inspector.md +3 -3
- package/docs/03-guides/03-ci.md +88 -128
- package/docs/03-guides/04-triage.md +7 -15
- package/docs/03-guides/05-agent-factory.md +30 -36
- package/docs/04-reference/01-cli.md +104 -22
- package/docs/04-reference/02-board.md +60 -74
- package/docs/04-reference/03-http.md +119 -57
- package/docs/04-reference/05-conformance.md +31 -45
- package/docs/index.md +41 -65
- package/package.json +12 -83
- package/dist/a2-DiDc77Uf.mjs +0 -4238
- package/dist/access-DPcrKIH_.d.mts +0 -37
- package/dist/backend-a2/blob-vercel.d.mts +0 -8
- package/dist/backend-a2/blob-vercel.mjs +0 -81
- package/dist/backend-a2/contract.d.mts +0 -828
- package/dist/backend-a2/contract.mjs +0 -5
- package/dist/backend-a2/scheduler-local.d.mts +0 -11
- package/dist/backend-a2/scheduler-local.mjs +0 -2
- package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
- package/dist/backend-a2/scheduler-qstash.mjs +0 -522
- package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
- package/dist/backend-a2/scheduler-vercel.mjs +0 -204
- package/dist/backend-a2/store-memory.d.mts +0 -11
- package/dist/backend-a2/store-postgres.d.mts +0 -38
- package/dist/backend-a2/store-postgres.mjs +0 -2977
- package/dist/backend-a2/store-redis-http.d.mts +0 -17
- package/dist/backend-a2/store-redis-http.mjs +0 -520
- package/dist/backend-a2/store-redis.d.mts +0 -31
- package/dist/backend-a2/store-redis.mjs +0 -88
- package/dist/backend-a2/store-sqlite.d.mts +0 -12
- package/dist/backend-a2/store-sqlite.mjs +0 -31
- package/dist/backend-a2.d.mts +0 -2633
- package/dist/backend-a2.mjs +0 -3
- package/dist/backend-http-CaN06CaD.d.mts +0 -672
- package/dist/backend-http-CoaCghuJ.mjs +0 -18
- package/dist/backend-http-l5A8UmL-.mjs +0 -585
- package/dist/backend-http.d.mts +0 -10
- package/dist/backend-http.mjs +0 -2
- package/dist/backend-http.node.d.mts +0 -10
- package/dist/backend-http.node.mjs +0 -2
- package/dist/backend-vercel-BE65okBC.mjs +0 -86
- package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
- package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
- package/dist/backend-vercel.d.mts +0 -9
- package/dist/backend-vercel.mjs +0 -11
- package/dist/backend-vercel.node.d.mts +0 -17
- package/dist/backend-vercel.node.mjs +0 -2
- package/dist/blob-Bx8QPWEd.d.mts +0 -40
- package/dist/blob-WbB2DJKn.mjs +0 -201
- package/dist/errors-2vGs49Db.d.mts +0 -16
- package/dist/exports-BnUZuRm9.mjs +0 -1389
- package/dist/exports-u5mApVvn.d.mts +0 -5
- package/dist/files-SniSmeEr.mjs +0 -47
- package/dist/folds-DsWfIftc.mjs +0 -208
- package/dist/index-UXpTPWNc.d.mts +0 -11
- package/dist/index.default-Dp8gexln.mjs +0 -12
- package/dist/local-C76Fy5ad.mjs +0 -44
- package/dist/middleware-BavYSDUa.mjs +0 -62
- package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
- package/dist/project-4Vl7_uy5.mjs +0 -124
- package/dist/provider-gynDUoyW.d.mts +0 -665
- package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
- package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
- package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
- package/dist/reducers-DQVSP3kk.mjs +0 -538
- package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
- package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
- package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
- package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
- package/dist/server-wIpAEjpX.mjs +0 -17
- package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
- package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
- package/dist/store-memory-4IBl0Ztu.mjs +0 -2
- package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
- package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
- package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
- package/dist/targets-Cgjs29T0.mjs +0 -33
- package/dist/types-CmrFjpml.d.mts +0 -102
- package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
- package/docs/01-board/02-database.md +0 -258
- package/docs/04-reference/04-log.md +0 -247
- package/sql/postgres/board.sql +0 -145
- package/sql/postgres/notifications.sql +0 -24
- package/sql/postgres/schema.sql +0 -451
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# board
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
channels and threads, and a live tail. No accounts: people sign in
|
|
5
|
-
existing `vercel login`, and machines use their platform's OIDC
|
|
3
|
+
Your team's message board, for people and agents: one durable log, verified
|
|
4
|
+
authors, channels and threads, and a live tail. No accounts: people sign in
|
|
5
|
+
with their existing `vercel login`, and machines use their platform's OIDC
|
|
6
|
+
token.
|
|
6
7
|
|
|
7
8
|
The docs ship with the package, in [`docs/`](./docs/index.md).
|
|
8
9
|
|
|
@@ -11,20 +12,21 @@ pnpm i @vercel/board
|
|
|
11
12
|
```
|
|
12
13
|
|
|
13
14
|
```ts
|
|
14
|
-
//
|
|
15
|
+
// scripts/deployed.ts
|
|
15
16
|
import { board } from '@vercel/board'
|
|
16
|
-
import { a2 } from '@vercel/board/backend-a2'
|
|
17
17
|
|
|
18
|
-
const team = board(
|
|
19
|
-
|
|
18
|
+
const team = board()
|
|
19
|
+
await team.post('deploys', 'www@a1b2c3 is live')
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
`board()` is your team's board in Vercel's API, so there's nothing to deploy
|
|
23
|
+
or keep. In a Vercel deployment it acts as the project, with its OIDC token,
|
|
24
|
+
and on your machine as you, with your `vercel login`. A route that exports
|
|
25
|
+
`team.fetch` as `GET` and `POST` runs its watchers: see
|
|
26
|
+
[Mounting](./docs/01-board/01-mounting.md).
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
|
-
|
|
29
|
+
vercel link # the CLI uses your team's board
|
|
28
30
|
npx vb post errors-www "deploy failed on a1b2c3"
|
|
29
31
|
npx vb read errors-www
|
|
30
32
|
npx vb wait --re 812 --timeout 30m
|
|
@@ -49,23 +51,25 @@ restarts, runs its timers in its own process, and has no sync. You're
|
|
|
49
51
|
it, agents included, finds its token on its own: the token lives in a file
|
|
50
52
|
only you can read, for as long as the board runs.
|
|
51
53
|
|
|
54
|
+
In code, `local()` from `@vercel/board/backend-local` keeps the same kind of
|
|
55
|
+
board in your process, `board({ backend: local() })`, and
|
|
56
|
+
`local({ memory: true })` keeps it in memory for tests. See [Local boards](./docs/01-board/10-local.md).
|
|
57
|
+
|
|
52
58
|
## Collaborate from a local coding project
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
your agents:
|
|
60
|
+
In a linked Vercel project, the CLI talks to the team's board in Vercel's API,
|
|
61
|
+
the team `vercel link` names. Install the collaboration skill for your agents:
|
|
56
62
|
|
|
57
63
|
```bash
|
|
58
|
-
export BOARD_URL=https://team.example/api/board
|
|
59
64
|
npx skills add vercel-labs/board --skill board -g
|
|
60
65
|
```
|
|
61
66
|
|
|
62
|
-
`--url <url>`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
token elsewhere. Each person authenticates with their own `vercel login`;
|
|
67
|
+
`BOARD_URL`, or `--url <url>` for one command, points at a board at a URL
|
|
68
|
+
instead. Nothing in a checkout picks a host, so a repo you clone can't send
|
|
69
|
+
your token elsewhere. Each person authenticates with their own `vercel login`;
|
|
66
70
|
credentials stay in the user-level cache.
|
|
67
71
|
|
|
68
|
-
If
|
|
72
|
+
If a board's deployment is behind Vercel Deployment Protection (Vercel
|
|
69
73
|
Authentication protects production too on many teams), the CLI and a handle in
|
|
70
74
|
Node get through the way `vercel curl` does: with your `vercel login` they find the
|
|
71
75
|
board's project from its host, read its Protection Bypass for Automation
|
|
@@ -86,7 +90,8 @@ the project.
|
|
|
86
90
|
|
|
87
91
|
The design lives in [SPEC.md](../../SPEC.md). Status: the board, its handle, the CLI,
|
|
88
92
|
inspector, Slack, GitHub, and Linear sync, and watchers work;
|
|
89
|
-
cursors are next.
|
|
93
|
+
cursors are next. Vercel's board doesn't run sync yet, so a board with sync
|
|
94
|
+
runs on `local()`, in a long-running process.
|
|
90
95
|
|
|
91
96
|
## Connect
|
|
92
97
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { a as forbidden } from "./errors-Pk0XV1hK.mjs";
|
|
2
|
+
import { a as ChannelPath, h as SCOPE_MAX } from "./schemas-BG205xds.mjs";
|
|
3
3
|
//#region src/server/access.ts
|
|
4
4
|
/**
|
|
5
5
|
* What a principal may do in a channel. `read` covers messages, threads,
|
|
@@ -239,4 +239,4 @@ function authorize(access, permission, channel, hidden) {
|
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
//#endregion
|
|
242
|
-
export {
|
|
242
|
+
export { parsePattern as a, union as c, compileAccess as i, PERMISSIONS as n, parseScope as o, authorize as r, scopeOf as s, FULL_ACCESS as t };
|
package/dist/access.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { C as Author, t as Actor } from "./folds-DLUzfibJ.mjs";
|
|
1
|
+
import { S as union, _ as ChannelPattern, b as Permission, f as Author, g as Can, h as AccessSummary, m as Access, t as Actor, v as FULL_ACCESS, x as compileAccess, y as Grant } from "./folds-DjFTiqIM.mjs";
|
|
2
|
+
import { a as DEFAULT_CAN, c as IssuerConfig, f as Principal, i as Claims, l as Known, n as AuthenticateContext, p as PrincipalKind, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions } from "./auth-D6z3rMNj.mjs";
|
|
4
3
|
//#region src/server/tokens.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The OIDC tokens made out to this board: a request's bearer token, from Vercel (people and
|
|
7
|
-
* deployments), GitHub Actions, an
|
|
6
|
+
* deployments), GitHub Actions, an issuer a grant names, or `local`'s (`vb serve`'s), verified
|
|
8
7
|
* for the board's URL. Null for a request with no token, and a 401 for one whose token fails.
|
|
9
8
|
* Without `request.board`, the board's project is the environment's, and it trusts no issuer past
|
|
10
9
|
* Vercel's and GitHub's.
|
|
@@ -26,4 +25,4 @@ type ResolvedActor = {
|
|
|
26
25
|
*/
|
|
27
26
|
export declare function resolveActor(principal: Principal, claims: Claims, audience: string): ResolvedActor;
|
|
28
27
|
//#endregion
|
|
29
|
-
export { type Access, type
|
|
28
|
+
export { type Access, type AccessSummary, type Authenticate, type AuthenticateContext, type CallerRequest, type Can, type ChannelPattern, type Claims, DEFAULT_CAN, FULL_ACCESS, type Grant, type HostPrincipal, type IssuerConfig, type Known, type OidcTokensOptions, type Permission, type Principal, type PrincipalKind, compileAccess, union };
|
package/dist/access.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as resolveActor } from "./actors-
|
|
3
|
-
import {
|
|
4
|
-
import { t as oidcTokens } from "./tokens-
|
|
5
|
-
export { DEFAULT_CAN, FULL_ACCESS, compileAccess,
|
|
1
|
+
import { c as union, i as compileAccess, t as FULL_ACCESS } from "./access-N3XmkKXg.mjs";
|
|
2
|
+
import { i as resolveActor } from "./actors-ihyN47OV.mjs";
|
|
3
|
+
import { n as DEFAULT_CAN } from "./auth-r-_PeZyw.mjs";
|
|
4
|
+
import { t as oidcTokens } from "./tokens-DPKjl3jf.mjs";
|
|
5
|
+
export { DEFAULT_CAN, FULL_ACCESS, compileAccess, oidcTokens, resolveActor, union };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as badRequest } from "./errors-Pk0XV1hK.mjs";
|
|
2
|
+
import { b as toStorable } from "./schemas-BG205xds.mjs";
|
|
3
|
+
import { o as parseScope } from "./access-N3XmkKXg.mjs";
|
|
4
4
|
import { t as own } from "./own-OwgPWdmh.mjs";
|
|
5
5
|
import { t as extractMentions } from "./mentions-CB6ShY4R.mjs";
|
|
6
6
|
//#region src/server/actors.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { g as Can, m as Access } from "./folds-DjFTiqIM.mjs";
|
|
2
|
+
import { JWTVerifyGetKey } from "jose";
|
|
3
3
|
//#region src/server/auth.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* What a request says about who's calling, beside its credential: labels the caller picks for
|
|
@@ -67,75 +67,13 @@ type Pinned = {
|
|
|
67
67
|
type Granted = Principal & {
|
|
68
68
|
access: Access;
|
|
69
69
|
};
|
|
70
|
-
/** A verified token's claims, as rules match them. */
|
|
71
|
-
type TokenClaims = JWTPayload & Record<string, unknown>;
|
|
72
70
|
/** What a verified token said: its issuer and its claims, never the token itself. */
|
|
73
71
|
type TokenFacts = {
|
|
74
72
|
/** `host`: a host's own verifier recognized the caller; its claims are when that runs out. */
|
|
75
73
|
issuer: 'vercel' | 'github' | 'oidc' | 'host';
|
|
76
74
|
iss: string;
|
|
77
75
|
claims: Readonly<Record<string, string | number | boolean>>;
|
|
78
|
-
/**
|
|
79
|
-
* The board's own Vercel team, as the board knew it when it verified the
|
|
80
|
-
* token. A schedule's send may run where the board can't work it out (the
|
|
81
|
-
* scheduler's own function, with no request to learn it from), and a rule
|
|
82
|
-
* naming a project without its team needs it. Only the board writes it.
|
|
83
|
-
*/
|
|
84
|
-
team?: string;
|
|
85
76
|
};
|
|
86
|
-
/** What a rule may compare claims to: the board's own Vercel team and project, when they're known. */
|
|
87
|
-
type MatchContext = {
|
|
88
|
-
teamId: string | null;
|
|
89
|
-
projectId: string | null;
|
|
90
|
-
};
|
|
91
|
-
/** One entry in `board({ access })`: who it matches, and what they may do. The first entry that matches decides. */
|
|
92
|
-
type AccessRule = {
|
|
93
|
-
/** `vercel` and `github` are their platforms' issuers; `oidc` is the exact `url`. */
|
|
94
|
-
issuer: 'vercel' | 'github' | 'oidc';
|
|
95
|
-
/** For `oidc`: the issuer URL, pinned in code. */
|
|
96
|
-
url?: string;
|
|
97
|
-
matches(claims: TokenClaims, context: MatchContext): boolean;
|
|
98
|
-
access: Access;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* A Vercel project's deployments, by name or ID. A name is only unique within
|
|
102
|
-
* a team, so without `team` it means the board's own team, and matches nothing
|
|
103
|
-
* when that isn't known. An ID is unique on Vercel, so it matches on any team.
|
|
104
|
-
* `'self'` is the board's own project: its deployments in the environment the
|
|
105
|
-
* board runs in have full access unless a rule says otherwise, and its other
|
|
106
|
-
* environments have none unless one lists them. Its development tokens are
|
|
107
|
-
* people, which no rule changes.
|
|
108
|
-
*/
|
|
109
|
-
declare function vercelProject(options: {
|
|
110
|
-
project: string;
|
|
111
|
-
team?: string;
|
|
112
|
-
environments?: readonly string[];
|
|
113
|
-
can: Can;
|
|
114
|
-
}): AccessRule;
|
|
115
|
-
/**
|
|
116
|
-
* A GitHub Actions workflow. A `pull_request` run's token carries
|
|
117
|
-
* `ref: refs/pull/<n>/merge`, so match those on `event` and `workflow`, not `ref`.
|
|
118
|
-
*/
|
|
119
|
-
declare function githubActions(options: {
|
|
120
|
-
repository: string;
|
|
121
|
-
event?: string | readonly string[];
|
|
122
|
-
workflow?: string;
|
|
123
|
-
ref?: string;
|
|
124
|
-
can: Can;
|
|
125
|
-
}): AccessRule;
|
|
126
|
-
/**
|
|
127
|
-
* Any OIDC issuer's tokens: GitLab, Buildkite, a cloud's workload identity.
|
|
128
|
-
* The issuer is pinned here, and only issuers some rule names are trusted or
|
|
129
|
-
* have their keys fetched. Every listed claim must match exactly (a list is
|
|
130
|
-
* any of its values), and there must be at least one, since an issuer signs
|
|
131
|
-
* tokens for everyone it serves. The principal is `oidc:<issuer host and path>:<sub>`,
|
|
132
|
-
* with any `:` or `%` in the issuer part percent-encoded, so it ends at the first `:`.
|
|
133
|
-
*/
|
|
134
|
-
declare function oidc(options: {
|
|
135
|
-
issuer: string;
|
|
136
|
-
claims: Readonly<Record<string, string | readonly string[]>>;
|
|
137
|
-
can: Can;
|
|
138
|
-
}): AccessRule;
|
|
139
77
|
type IssuerConfig = {
|
|
140
78
|
/** Accepted `iss` values. */
|
|
141
79
|
issuer: string | RegExp;
|
|
@@ -146,7 +84,7 @@ type IssuerConfig = {
|
|
|
146
84
|
type OidcTokensOptions = {
|
|
147
85
|
vercel?: IssuerConfig;
|
|
148
86
|
github?: IssuerConfig;
|
|
149
|
-
/** Keys for
|
|
87
|
+
/** Keys for the OIDC issuers grants name, by issuer URL, instead of their published JWKS. It trusts no issuer by itself. */
|
|
150
88
|
oidc?: Readonly<Record<string, JWTVerifyGetKey>>;
|
|
151
89
|
/**
|
|
152
90
|
* A local board's own issuer (`vb serve`): its tokens' `sub` is a person on
|
|
@@ -158,18 +96,6 @@ type OidcTokensOptions = {
|
|
|
158
96
|
jwks: JWTVerifyGetKey;
|
|
159
97
|
};
|
|
160
98
|
};
|
|
161
|
-
/**
|
|
162
|
-
* What a host's own model gives a principal: what it may do, or null for nothing. It sees only the
|
|
163
|
-
* principals its own `authenticate` returned.
|
|
164
|
-
*/
|
|
165
|
-
type AccessFunction = (principal: Known) => Can | null | undefined | Promise<Can | null | undefined>;
|
|
166
|
-
/**
|
|
167
|
-
* A rule of your own, among `vercelProject()` and the rest: what it gives a principal (`'all'`,
|
|
168
|
-
* `['read']`, `{ 'support/': ['read', 'post'] }`), null for nothing, or undefined to leave it to the
|
|
169
|
-
* next rule. It's asked whenever a principal acts, a schedule's send included, and never about a
|
|
170
|
-
* person or the board's own deployments in its environment, which the defaults decide first.
|
|
171
|
-
*/
|
|
172
|
-
type RuleFunction = (principal: Known) => Can | null | undefined | Promise<Can | null | undefined>;
|
|
173
99
|
/** A principal as the board keeps it to work its access out again: who it is, its token's facts, its scope, and the board token it came with. */
|
|
174
100
|
type Known = Pick<Principal, 'id' | 'kind' | 'handle' | 'facts' | 'scope' | 'token'>;
|
|
175
101
|
/** A grant the board keeps: its ID, its issuer and claims as the board checked them, and who set it when. */
|
|
@@ -188,26 +114,14 @@ type StoredGrant = {
|
|
|
188
114
|
* exports it, so code that imports it can't widen them.
|
|
189
115
|
*/
|
|
190
116
|
declare const DEFAULT_CAN: Can;
|
|
191
|
-
/**
|
|
192
|
-
* What a principal may do under `rules` (`vercelProject()`, `githubActions()`, `oidc()`, and
|
|
193
|
-
* functions of your own), the first that matches deciding, past the defaults: people, and the
|
|
194
|
-
* board's own deployments in the environment it runs in, may do everything. Its scope narrows what
|
|
195
|
-
* it gets. A 401 or 403 that names the rule that would let it in, when it may do nothing.
|
|
196
|
-
*/
|
|
197
|
-
declare function compileRules(rules: readonly (AccessRule | RuleFunction)[], board: {
|
|
198
|
-
project(): Promise<{
|
|
199
|
-
id: string | null;
|
|
200
|
-
teamId: string | null;
|
|
201
|
-
}>;
|
|
202
|
-
}): (principal: Known) => Promise<Access>;
|
|
203
|
-
/** What board() knows that verifying a request needs: its own Vercel project, and the OIDC issuers its rules trust. */
|
|
117
|
+
/** What board() knows that verifying a request needs: its own Vercel project, and the OIDC issuers its grants trust. */
|
|
204
118
|
type AuthenticateContext = {
|
|
205
119
|
/** The board's own Vercel project and team: its people's development tokens are for it. */
|
|
206
120
|
project(): Promise<{
|
|
207
121
|
id: string | null;
|
|
208
122
|
teamId: string | null;
|
|
209
123
|
}>;
|
|
210
|
-
/** OIDC issuers past Vercel's and GitHub's whose tokens may be trusted: the ones
|
|
124
|
+
/** OIDC issuers past Vercel's and GitHub's whose tokens may be trusted: the ones grants name. */
|
|
211
125
|
issuers: readonly string[];
|
|
212
126
|
};
|
|
213
127
|
/** What a verifier gets: what the request said, and what the board knows that verifying it needs. */
|
|
@@ -220,7 +134,7 @@ type AuthenticateRequest = CallerRequest & {
|
|
|
220
134
|
* `request.headers`, say). Null when the request carries nothing it recognizes, so verifiers
|
|
221
135
|
* compose: `(request) => (await staff(request)) ?? (await tokens(request))`. To reject a
|
|
222
136
|
* credential that fails, throw an `HttpError` (a 401), or return or throw a `Response`; anything
|
|
223
|
-
* else thrown is a 500. What a principal may do is
|
|
137
|
+
* else thrown is a 500. What a principal may do is the board's defaults' and grants' to say.
|
|
224
138
|
*/
|
|
225
139
|
type Authenticate = (request: AuthenticateRequest) => Principal | HostPrincipal | Response | null | undefined | Promise<Principal | HostPrincipal | Response | null | undefined>;
|
|
226
140
|
/** What a host's own verifier returns: a principal in the board's ID scheme. */
|
|
@@ -233,4 +147,4 @@ type HostPrincipal = {
|
|
|
233
147
|
expiresAt?: Date | null;
|
|
234
148
|
};
|
|
235
149
|
//#endregion
|
|
236
|
-
export {
|
|
150
|
+
export { DEFAULT_CAN as a, IssuerConfig as c, Pinned as d, Principal as f, Claims as i, Known as l, StoredGrant as m, AuthenticateContext as n, Granted as o, PrincipalKind as p, CallerRequest as r, HostPrincipal as s, Authenticate as t, OidcTokensOptions as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as forbidden, l as unauthorized, r as badRequest } from "./errors-
|
|
2
|
-
import {
|
|
1
|
+
import { a as forbidden, l as unauthorized, r as badRequest, t as HttpError } from "./errors-Pk0XV1hK.mjs";
|
|
2
|
+
import { c as union, i as compileAccess, o as parseScope, t as FULL_ACCESS } from "./access-N3XmkKXg.mjs";
|
|
3
3
|
//#region src/server/auth.ts
|
|
4
4
|
/**
|
|
5
5
|
* Whether a caller wrote what `by` says, as far as changing it goes (editing, deleting, canceling a
|
|
@@ -14,73 +14,6 @@ const wroteAs = (caller, by) => by.principal === caller.principal.id && ((caller
|
|
|
14
14
|
* platform actor sync writes as may have one, or an import could pass for someone signed in.
|
|
15
15
|
*/
|
|
16
16
|
const authenticates = (id) => /^(vercel|oidc|local|board):/.test(id) || id.startsWith("github:repo:");
|
|
17
|
-
/** A token no rule matches, and the rule that would let it in. */
|
|
18
|
-
const notInAccess = (rule) => forbidden(`this token can't use this board: add ${rule} to access`);
|
|
19
|
-
/** A rule's `can`, compiled. A rule without one says which rule and what to write. */
|
|
20
|
-
function accessOf(rule, can) {
|
|
21
|
-
if (can === void 0 || can === null) throw new Error(`${rule} needs can: say what it may do, like can: { 'ci/': ['read', 'post'] }, or can: 'all'`);
|
|
22
|
-
return compileAccess(can);
|
|
23
|
-
}
|
|
24
|
-
const oneOf = (value, allowed) => allowed === void 0 || typeof value === "string" && (typeof allowed === "string" ? [allowed] : allowed).includes(value);
|
|
25
|
-
/**
|
|
26
|
-
* A Vercel project's deployments, by name or ID. A name is only unique within
|
|
27
|
-
* a team, so without `team` it means the board's own team, and matches nothing
|
|
28
|
-
* when that isn't known. An ID is unique on Vercel, so it matches on any team.
|
|
29
|
-
* `'self'` is the board's own project: its deployments in the environment the
|
|
30
|
-
* board runs in have full access unless a rule says otherwise, and its other
|
|
31
|
-
* environments have none unless one lists them. Its development tokens are
|
|
32
|
-
* people, which no rule changes.
|
|
33
|
-
*/
|
|
34
|
-
function vercelProject(options) {
|
|
35
|
-
if (options.project === "self" && options.team !== void 0) throw new Error("vercelProject({ project: 'self' }) is the board's own project: drop team");
|
|
36
|
-
return {
|
|
37
|
-
issuer: "vercel",
|
|
38
|
-
access: accessOf(`vercelProject({ project: '${options.project}' })`, options.can),
|
|
39
|
-
matches: (claims, { teamId, projectId }) => (options.project === "self" ? projectId !== null && claims.project_id === projectId : claims.project_id === options.project || claims.project === options.project && (options.team === void 0 ? teamId !== null && claims.owner_id === teamId : claims.owner === options.team || claims.owner_id === options.team)) && oneOf(claims.environment, options.environments)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* A GitHub Actions workflow. A `pull_request` run's token carries
|
|
44
|
-
* `ref: refs/pull/<n>/merge`, so match those on `event` and `workflow`, not `ref`.
|
|
45
|
-
*/
|
|
46
|
-
function githubActions(options) {
|
|
47
|
-
return {
|
|
48
|
-
issuer: "github",
|
|
49
|
-
access: accessOf(`githubActions({ repository: '${options.repository}' })`, options.can),
|
|
50
|
-
matches: (claims) => claims.repository === options.repository && oneOf(claims.event_name, options.event) && (options.ref === void 0 || claims.ref === options.ref) && (options.workflow === void 0 || typeof claims.workflow_ref === "string" && claims.workflow_ref.startsWith(`${options.repository}/${options.workflow}@`))
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Any OIDC issuer's tokens: GitLab, Buildkite, a cloud's workload identity.
|
|
55
|
-
* The issuer is pinned here, and only issuers some rule names are trusted or
|
|
56
|
-
* have their keys fetched. Every listed claim must match exactly (a list is
|
|
57
|
-
* any of its values), and there must be at least one, since an issuer signs
|
|
58
|
-
* tokens for everyone it serves. The principal is `oidc:<issuer host and path>:<sub>`,
|
|
59
|
-
* with any `:` or `%` in the issuer part percent-encoded, so it ends at the first `:`.
|
|
60
|
-
*/
|
|
61
|
-
function oidc(options) {
|
|
62
|
-
let url;
|
|
63
|
-
try {
|
|
64
|
-
url = new URL(options.issuer);
|
|
65
|
-
} catch {
|
|
66
|
-
throw new Error(`oidc: issuer must be a URL, got ${options.issuer}`);
|
|
67
|
-
}
|
|
68
|
-
if (url.protocol !== "https:" || url.search || url.hash || url.username || url.password) throw new Error(`oidc: issuer must be an https URL with no query or credentials, got ${options.issuer}`);
|
|
69
|
-
if (VERCEL_ISSUER.test(options.issuer)) throw new Error("oidc: use vercelProject() for Vercel tokens");
|
|
70
|
-
if (options.issuer === "https://token.actions.githubusercontent.com") throw new Error("oidc: use githubActions() for GitHub Actions tokens");
|
|
71
|
-
const required = Object.entries(options.claims);
|
|
72
|
-
if (required.length === 0) throw new Error(`oidc: name at least one claim to match for ${options.issuer}`);
|
|
73
|
-
for (const [name, allowed] of required) {
|
|
74
|
-
const values = typeof allowed === "string" ? [allowed] : Array.isArray(allowed) ? allowed : [];
|
|
75
|
-
if (values.length === 0 || values.some((value) => typeof value !== "string" || value === "")) throw new Error(`oidc: claim ${name} has no value to match for ${options.issuer}`);
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
issuer: "oidc",
|
|
79
|
-
url: options.issuer,
|
|
80
|
-
access: accessOf(`oidc({ issuer: '${options.issuer}' })`, options.can),
|
|
81
|
-
matches: (claims) => required.every(([name, allowed]) => oneOf(claims[name], allowed))
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
17
|
const VERCEL_ISSUER = /^https:\/\/oidc\.vercel\.com(?:\/[a-z0-9-]+)?$/;
|
|
85
18
|
const GITHUB_ISSUER = "https://token.actions.githubusercontent.com";
|
|
86
19
|
/**
|
|
@@ -100,13 +33,11 @@ function trustedIssuers(issuers) {
|
|
|
100
33
|
for (const iss of issuers) {
|
|
101
34
|
const name = issuerName(iss);
|
|
102
35
|
const other = named.get(name);
|
|
103
|
-
if (other !== void 0 && other !== iss) throw new Error(`
|
|
36
|
+
if (other !== void 0 && other !== iss) throw new Error(`oidc issuers ${other} and ${iss} name the same principals, oidc:${name}:<sub>: pin one of them`);
|
|
104
37
|
named.set(name, iss);
|
|
105
38
|
}
|
|
106
39
|
return new Set(issuers);
|
|
107
40
|
}
|
|
108
|
-
/** The OIDC issuers rules name: the only ones whose tokens are verified for them. */
|
|
109
|
-
const issuersOf = (rules) => [...new Set(rules.flatMap((rule) => typeof rule !== "function" && rule.issuer === "oidc" ? [rule.url] : []))];
|
|
110
41
|
/** What a board token starts with, so board() knows its own before it tries any other verifier. */
|
|
111
42
|
const BOARD_TOKEN_PREFIX = "board_";
|
|
112
43
|
/**
|
|
@@ -142,8 +73,8 @@ function privateHost(host) {
|
|
|
142
73
|
/**
|
|
143
74
|
* A grant checked and put in one form: its issuer, its claims with keys and lists sorted, its
|
|
144
75
|
* `can`, and the key that says it's the same grant as another. A 400 `invalid_grant` that says
|
|
145
|
-
* what to write. `trusted`: the issuers
|
|
146
|
-
*
|
|
76
|
+
* what to write. `trusted`: the issuers other grants name, which no two may share principals
|
|
77
|
+
* between.
|
|
147
78
|
*/
|
|
148
79
|
function checkGrant(spec, trusted) {
|
|
149
80
|
const { issuer } = spec;
|
|
@@ -201,75 +132,45 @@ function grantMatches(grant, facts) {
|
|
|
201
132
|
}
|
|
202
133
|
/** The OIDC issuers grants name past Vercel and GitHub: their tokens are verified too. */
|
|
203
134
|
const grantIssuers = (grants) => [...new Set(grants.flatMap((grant) => grant.issuer === "vercel" || grant.issuer === "github" ? [] : [grant.issuer]))];
|
|
135
|
+
/** A token no grant lets in, and the grant that would. */
|
|
136
|
+
const notGranted = (who, grant) => new HttpError(403, "forbidden", `this token can't use this board: no grant lets in ${who}`, { hint: `Grant it: vb grants create ${grant}` });
|
|
204
137
|
/**
|
|
205
|
-
* What principals may do,
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* everything). Or a host's own function of the principal.
|
|
138
|
+
* What principals may do: people, and the board's own deployments in its environment, everything;
|
|
139
|
+
* anyone else what the board's grants that match its token give, all of them adding up. A board
|
|
140
|
+
* token's principal is the one that minted it, narrowed.
|
|
209
141
|
*/
|
|
210
142
|
function createAuthority(options) {
|
|
211
|
-
const rules = typeof options.access === "function" ? [] : options.access;
|
|
212
|
-
const host = typeof options.access === "function" ? options.access : null;
|
|
213
|
-
const oidcIssuers = trustedIssuers(issuersOf(rules));
|
|
214
143
|
/**
|
|
215
|
-
* What
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* unless a token's rule says otherwise, no function is asked about them, and no grant is theirs;
|
|
219
|
-
* a function that answers null refuses, grants or not. A 401 or 403 that says which rule would
|
|
220
|
-
* let it in, when nothing does.
|
|
144
|
+
* What a principal that isn't a person may do: everything for the board's own deployments in its
|
|
145
|
+
* environment, and for anyone else, every grant that matches its token, added up. A 401 or 403
|
|
146
|
+
* that says which grant would let it in, when none does.
|
|
221
147
|
*/
|
|
222
|
-
async function
|
|
223
|
-
if (facts?.issuer === "host") throw forbidden("this token can't use this board: its board no longer takes a host's principals");
|
|
148
|
+
async function byGrants(facts) {
|
|
224
149
|
const claims = facts?.claims ?? {};
|
|
225
150
|
const own = facts?.issuer === "vercel" ? await options.project() : null;
|
|
226
|
-
const context = own ? {
|
|
227
|
-
teamId: facts.team ?? own.teamId,
|
|
228
|
-
projectId: own.id
|
|
229
|
-
} : {
|
|
230
|
-
teamId: null,
|
|
231
|
-
projectId: null
|
|
232
|
-
};
|
|
233
151
|
const environment = String(claims.environment ?? "");
|
|
234
152
|
const here = boardEnvironment();
|
|
235
153
|
const ownDeployment = own !== null && own.id !== null && claims.project_id === own.id;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
for (const rule of rules) {
|
|
239
|
-
if (typeof rule === "function") {
|
|
240
|
-
if (ownHere) continue;
|
|
241
|
-
const can = await rule(principal);
|
|
242
|
-
if (can === void 0) continue;
|
|
243
|
-
if (can === null) throw forbidden("this token can't use this board");
|
|
244
|
-
ruled = compileAccess(can);
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
if (facts && rule.issuer === facts.issuer && (rule.issuer !== "oidc" || rule.url === facts.iss) && rule.matches(claims, context)) {
|
|
248
|
-
ruled = rule.access;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (ownHere) return ruled ?? FULL_ACCESS;
|
|
253
|
-
if (!facts) {
|
|
254
|
-
if (ruled) return ruled;
|
|
255
|
-
throw forbidden("this token can't use this board");
|
|
256
|
-
}
|
|
154
|
+
if (ownDeployment && here !== null && environment === here) return FULL_ACCESS;
|
|
155
|
+
if (!facts) throw forbidden("this token can't use this board");
|
|
257
156
|
const grants = options.grants ? await options.grants() : [];
|
|
258
157
|
const granted = grants.filter((grant) => grantMatches(grant, facts)).map((grant) => compileAccess(grant.can));
|
|
259
|
-
if (ruled) return granted.length > 0 ? union([ruled, ...granted]) : ruled;
|
|
260
158
|
if (granted.length > 0) return union(granted);
|
|
261
|
-
if (facts.issuer === "oidc" && !
|
|
262
|
-
if (facts.issuer === "oidc"
|
|
263
|
-
if (facts.issuer === "
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
159
|
+
if (facts.issuer === "oidc" && !grants.some((grant) => grant.issuer === facts.iss)) throw unauthorized(`untrusted issuer: ${facts.iss}`);
|
|
160
|
+
if (facts.issuer === "oidc") throw forbidden("this token can't use this board: no grant lets in its claims");
|
|
161
|
+
if (facts.issuer === "github") {
|
|
162
|
+
const repository = String(claims.repository ?? "");
|
|
163
|
+
throw notGranted(repository || "its repository", `github --claim repository=${repository || "<OWNER/REPO>"}`);
|
|
164
|
+
}
|
|
165
|
+
const project = String(claims.project_id ?? "") || "<PROJECT_ID>";
|
|
166
|
+
const grant = `vercel --claim project_id=${project} --claim environment=${environment || "<ENVIRONMENT>"}`;
|
|
167
|
+
if (ownDeployment) throw new HttpError(403, "forbidden", `this token can't use this board: it runs in ${here ?? "no Vercel environment"}, and its ${environment || "unnamed"} deployments need a grant`, { hint: `Grant them: vb grants create ${grant}` });
|
|
168
|
+
throw notGranted(`project ${project} in ${environment || "no environment"}`, grant);
|
|
267
169
|
}
|
|
268
170
|
/**
|
|
269
171
|
* What a principal may do now, narrowed by its scope: the board's own code and the platform users
|
|
270
|
-
* sync writes as everything; anyone else what
|
|
271
|
-
*
|
|
272
|
-
* what its kind is, until it expires. A 401 or 403 when it may do nothing.
|
|
172
|
+
* sync writes as everything; a person everything; anyone else what the board's grants give. A
|
|
173
|
+
* host's principal is what its kind is, until it expires. A 401 or 403 when it may do nothing.
|
|
273
174
|
*/
|
|
274
175
|
async function grant(principal) {
|
|
275
176
|
let access = FULL_ACCESS;
|
|
@@ -281,11 +182,7 @@ function createAuthority(options) {
|
|
|
281
182
|
const { exp } = principal.facts.claims;
|
|
282
183
|
if (typeof exp === "number" && exp * 1e3 <= Date.now()) throw unauthorized("token expired");
|
|
283
184
|
}
|
|
284
|
-
if (
|
|
285
|
-
const can = await host(principal);
|
|
286
|
-
if (can === null || can === void 0) throw forbidden("this token can't use this board");
|
|
287
|
-
access = compileAccess(can);
|
|
288
|
-
} else if (principal.kind !== "person") access = await byRules(principal, (hosted ? void 0 : principal.facts) ?? factsFromId(principal.id));
|
|
185
|
+
if (principal.kind !== "person") access = await byGrants((hosted ? void 0 : principal.facts) ?? factsFromId(principal.id));
|
|
289
186
|
}
|
|
290
187
|
return principal.scope === void 0 ? access : access.narrow(parseScope(principal.scope));
|
|
291
188
|
}
|
|
@@ -305,29 +202,16 @@ function createAuthority(options) {
|
|
|
305
202
|
};
|
|
306
203
|
}
|
|
307
204
|
/**
|
|
308
|
-
* What a principal may do under `rules` (`vercelProject()`, `githubActions()`, `oidc()`, and
|
|
309
|
-
* functions of your own), the first that matches deciding, past the defaults: people, and the
|
|
310
|
-
* board's own deployments in the environment it runs in, may do everything. Its scope narrows what
|
|
311
|
-
* it gets. A 401 or 403 that names the rule that would let it in, when it may do nothing.
|
|
312
|
-
*/
|
|
313
|
-
function compileRules(rules, board) {
|
|
314
|
-
return createAuthority({
|
|
315
|
-
access: rules,
|
|
316
|
-
project: () => board.project(),
|
|
317
|
-
hosts: true
|
|
318
|
-
}).grant;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
205
|
* The Vercel environment the board runs in: `production`, `preview`, or a
|
|
322
206
|
* custom environment's name. `VERCEL_TARGET_ENV` names custom environments,
|
|
323
207
|
* where `VERCEL_ENV` says `preview`. Null outside Vercel, where only people
|
|
324
|
-
* get in without a
|
|
208
|
+
* get in without a grant.
|
|
325
209
|
*/
|
|
326
210
|
const boardEnvironment = () => process.env.VERCEL_TARGET_ENV || process.env.VERCEL_ENV || null;
|
|
327
211
|
/**
|
|
328
212
|
* What a principal's ID still says, for one stored before the board kept
|
|
329
213
|
* claims: a deployment's project ID and environment. A workflow's ID names
|
|
330
|
-
* neither its repository nor its run, so it says nothing, and a
|
|
214
|
+
* neither its repository nor its run, so it says nothing, and a grant that
|
|
331
215
|
* needs more than the ID no longer matches.
|
|
332
216
|
*/
|
|
333
217
|
function factsFromId(id) {
|
|
@@ -390,4 +274,4 @@ function hostPrincipal(value) {
|
|
|
390
274
|
};
|
|
391
275
|
}
|
|
392
276
|
//#endregion
|
|
393
|
-
export {
|
|
277
|
+
export { verifiesTokens as _, VERCEL_ISSUER as a, createAuthority as c, hostPrincipal as d, issuerName as f, trustedIssuers as g, tokenHash as h, TOKENS as i, fromTokens as l, privateHost as m, DEFAULT_CAN as n, authenticates as o, markVerified as p, GITHUB_ISSUER as r, checkGrant as s, BOARD_TOKEN_PREFIX as t, grantIssuers as u, wroteAs as v };
|