@vercel/connect 2.5.3 → 2.5.5
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/chat/webhook-verifier.d.ts +6 -3
- package/dist/chat/webhook-verifier.js +10 -4
- package/dist/eve/discord-credentials.js +2 -2
- package/dist/eve/github-credentials.js +2 -2
- package/dist/eve/linear-credentials.js +2 -2
- package/dist/eve/linq-credentials.d.ts +2 -2
- package/dist/eve/linq-credentials.js +2 -2
- package/dist/eve/microsoft-teams-credentials.js +2 -2
- package/dist/eve/sendblue-credentials.d.ts +2 -2
- package/dist/eve/sendblue-credentials.js +2 -2
- package/dist/eve/slack-credentials.js +2 -2
- package/package.json +2 -2
|
@@ -33,9 +33,12 @@ export type ConnectWebhookVerifierOptions = Parameters<typeof verifyVercelOidcTo
|
|
|
33
33
|
* current deployment's project and environment (`projectId` defaults to
|
|
34
34
|
* `VERCEL_PROJECT_ID`, `environment` to `VERCEL_TARGET_ENV` then
|
|
35
35
|
* `VERCEL_ENV`). Verification fails closed — if those values are absent
|
|
36
|
-
* and not supplied via `options`, every request is rejected.
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* and not supplied via `options`, every request is rejected. Unless
|
|
37
|
+
* `options.audience` is supplied, tokens re-minted by Vercel's
|
|
38
|
+
* audience exchange (which carry an `act` claim) are rejected, so a token
|
|
39
|
+
* handed to a third-party audience cannot be replayed here. The accepted
|
|
40
|
+
* set is therefore "any unexchanged Vercel OIDC token for this project +
|
|
41
|
+
* environment"; it is not pinned to a specific Connect
|
|
39
42
|
* connector or to a single deployment. To tighten or broaden it (extra
|
|
40
43
|
* audiences, multiple environments, an explicit project id), pass
|
|
41
44
|
* `options` through to {@link verifyVercelOidcToken}.
|
|
@@ -17,9 +17,12 @@ const BEARER_TOKEN_PATTERN = /^Bearer\s+(.+)$/i;
|
|
|
17
17
|
* current deployment's project and environment (`projectId` defaults to
|
|
18
18
|
* `VERCEL_PROJECT_ID`, `environment` to `VERCEL_TARGET_ENV` then
|
|
19
19
|
* `VERCEL_ENV`). Verification fails closed — if those values are absent
|
|
20
|
-
* and not supplied via `options`, every request is rejected.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* and not supplied via `options`, every request is rejected. Unless
|
|
21
|
+
* `options.audience` is supplied, tokens re-minted by Vercel's
|
|
22
|
+
* audience exchange (which carry an `act` claim) are rejected, so a token
|
|
23
|
+
* handed to a third-party audience cannot be replayed here. The accepted
|
|
24
|
+
* set is therefore "any unexchanged Vercel OIDC token for this project +
|
|
25
|
+
* environment"; it is not pinned to a specific Connect
|
|
23
26
|
* connector or to a single deployment. To tighten or broaden it (extra
|
|
24
27
|
* audiences, multiple environments, an explicit project id), pass
|
|
25
28
|
* `options` through to {@link verifyVercelOidcToken}.
|
|
@@ -41,7 +44,10 @@ export function createConnectWebhookVerifier(options) {
|
|
|
41
44
|
if (!token) {
|
|
42
45
|
throw new Error('Missing Authorization bearer token');
|
|
43
46
|
}
|
|
44
|
-
await verifyVercelOidcToken(token, options);
|
|
47
|
+
const { payload } = await verifyVercelOidcToken(token, options);
|
|
48
|
+
if (options?.audience === undefined && payload.act !== undefined) {
|
|
49
|
+
throw new Error('Exchanged OIDC tokens are not accepted');
|
|
50
|
+
}
|
|
45
51
|
return true;
|
|
46
52
|
};
|
|
47
53
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
2
2
|
import { getTokenResponse, } from '../index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Build {@link DiscordChannelCredentials} backed by a Vercel Connect Discord
|
|
@@ -38,6 +38,6 @@ export function connectDiscordCredentials(connector, params = {}, options) {
|
|
|
38
38
|
return {
|
|
39
39
|
applicationId: async () => (await resolveCredentials()).applicationId,
|
|
40
40
|
botToken: async () => (await resolveCredentials()).botToken,
|
|
41
|
-
webhookVerifier:
|
|
41
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
2
2
|
import { getConnectorMetadata, getToken, } from '../index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Build {@link GitHubChannelCredentials} backed by a Vercel Connect
|
|
@@ -20,7 +20,7 @@ export function connectGitHubCredentials(connector, params = {}, options) {
|
|
|
20
20
|
return {
|
|
21
21
|
appSlug: () => getGitHubAppSlug(connector, options),
|
|
22
22
|
installationToken: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
|
|
23
|
-
webhookVerifier:
|
|
23
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
async function getGitHubAppSlug(connector, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
2
2
|
import { getToken, } from '../index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Build {@link LinearChannelCredentials} backed by a Vercel Connect
|
|
@@ -14,6 +14,6 @@ import { getToken, } from '../index.js';
|
|
|
14
14
|
export function connectLinearCredentials(connector, params = {}, options) {
|
|
15
15
|
return {
|
|
16
16
|
accessToken: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
|
|
17
|
-
webhookVerifier:
|
|
17
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
2
2
|
import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
|
|
3
3
|
/** Linq channel credentials returned by {@link connectLinqCredentials}. */
|
|
4
4
|
export interface ConnectLinqCredentials {
|
|
5
5
|
/** Short-lived API key for outbound Linq API calls. */
|
|
6
6
|
apiKey: () => Promise<string>;
|
|
7
7
|
/** Verifies webhooks forwarded by Vercel Connect. */
|
|
8
|
-
webhookVerifier:
|
|
8
|
+
webhookVerifier: ConnectWebhookVerifier;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Token parameters accepted by {@link connectLinqCredentials}.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createConnectWebhookVerifier, } from '../chat/webhook-verifier.js';
|
|
2
2
|
import { getToken, } from '../index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Build Linq channel credentials backed by a Vercel Connect connector.
|
|
@@ -19,6 +19,6 @@ import { getToken, } from '../index.js';
|
|
|
19
19
|
export function connectLinqCredentials(connector, params = {}, options) {
|
|
20
20
|
return {
|
|
21
21
|
apiKey: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
|
|
22
|
-
webhookVerifier:
|
|
22
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
23
23
|
};
|
|
24
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
2
2
|
import { getConnectorMetadata, getTokenResponse, } from '../index.js';
|
|
3
3
|
const BOT_FRAMEWORK_SCOPE = 'https://api.botframework.com/.default';
|
|
4
4
|
/**
|
|
@@ -31,7 +31,7 @@ export function connectTeamsCredentials(connector, params = {}, options) {
|
|
|
31
31
|
}, options);
|
|
32
32
|
return { accessToken: response.token, expiresAt: response.expiresAt };
|
|
33
33
|
},
|
|
34
|
-
webhookVerifier:
|
|
34
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
async function getTeamsAppId(connector, options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConnectOptions } from '../index.js';
|
|
2
2
|
import { type ConnectSendblueParams } from '../internal/sendblue-lines.js';
|
|
3
|
-
import {
|
|
3
|
+
import { type ConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
4
4
|
/** Managed Sendblue channel credentials returned by {@link connectSendblueCredentials}. */
|
|
5
5
|
export interface ConnectSendblueCredentials {
|
|
6
6
|
/** Short-lived bearer token for outbound Sendblue API calls. */
|
|
@@ -10,7 +10,7 @@ export interface ConnectSendblueCredentials {
|
|
|
10
10
|
/** Every Sendblue line authorized for this connector. */
|
|
11
11
|
allowedFromNumbers: () => Promise<readonly string[]>;
|
|
12
12
|
/** Verifies webhooks forwarded by Vercel Connect. */
|
|
13
|
-
webhookVerifier:
|
|
13
|
+
webhookVerifier: ConnectWebhookVerifier;
|
|
14
14
|
}
|
|
15
15
|
/** Token parameters accepted by {@link connectSendblueCredentials}. */
|
|
16
16
|
export type ConnectSendblueCredentialsParams = ConnectSendblueParams;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createConnectSendblueConfig, } from '../internal/sendblue-lines.js';
|
|
2
|
-
import {
|
|
2
|
+
import { createConnectWebhookVerifier, } from '../chat/webhook-verifier.js';
|
|
3
3
|
/**
|
|
4
4
|
* Builds managed Sendblue channel credentials backed by a Vercel Connect
|
|
5
5
|
* connector. The access-token resolver and managed line resolvers keep token
|
|
@@ -9,6 +9,6 @@ import { vercelOidc } from 'eve/channels/auth';
|
|
|
9
9
|
export function connectSendblueCredentials(connector, params = {}, options) {
|
|
10
10
|
return {
|
|
11
11
|
...createConnectSendblueConfig(connector, params, options),
|
|
12
|
-
webhookVerifier:
|
|
12
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getToken, } from '../index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { createConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
3
3
|
/**
|
|
4
4
|
* Build {@link SlackChannelCredentials} backed by a Vercel Connect
|
|
5
5
|
* connector that stores a Slack workspace's bot token.
|
|
@@ -37,7 +37,7 @@ import { vercelOidc } from 'eve/channels/auth';
|
|
|
37
37
|
export function connectSlackCredentials(connector, params = {}, options) {
|
|
38
38
|
return {
|
|
39
39
|
botToken: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
|
|
40
|
-
webhookVerifier:
|
|
40
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
41
41
|
vercelConnect: {
|
|
42
42
|
connector,
|
|
43
43
|
requirement: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/connect",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dist"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@vercel/oidc": "4.0.
|
|
53
|
+
"@vercel/oidc": "4.0.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@ai-sdk/mcp": "^1 || ^2",
|