@lightdash/cli 2.575.4 → 2.576.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/.tsbuildinfo.build +1 -1
- package/dist/agentConnections/agentTokenProvider.d.ts.map +1 -1
- package/dist/agentConnections/agentTokenProvider.js +11 -0
- package/dist/agentConnections/approvedProjectProof.d.ts +8 -0
- package/dist/agentConnections/approvedProjectProof.d.ts.map +1 -0
- package/dist/agentConnections/approvedProjectProof.js +49 -0
- package/dist/agentConnections/initialToken.d.ts +2 -1
- package/dist/agentConnections/initialToken.d.ts.map +1 -1
- package/dist/agentConnections/initialToken.js +8 -9
- package/dist/agentConnections/schema.d.ts.map +1 -1
- package/dist/agentConnections/schema.js +2 -1
- package/dist/handlers/agentConnectionConnect.d.ts.map +1 -1
- package/dist/handlers/agentConnectionConnect.js +3 -19
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentTokenProvider.d.ts","sourceRoot":"","sources":["../../src/agentConnections/agentTokenProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAoB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"agentTokenProvider.d.ts","sourceRoot":"","sources":["../../src/agentConnections/agentTokenProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAoB,MAAM,SAAS,CAAC;AAyDjE,eAAO,MAAM,gBAAgB,SACnB,mBAAmB,OACpB,MAAM,KACZ,IAsCF,CAAC;AAEF,qBAAa,kBAAkB;IAIvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAH1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C,YACqB,KAAK,GAAE,oBAAiD,EACzE;YAEU,MAAM;YA+DN,SAAS;IAkBjB,QAAQ,CACV,GAAG,EAAE,OAAO,EACZ,kBAAkB,GAAE,MAAM,GAAG,IAAW,EACxC,kBAAkB,GAAE,MAAM,GAAG,IAAW,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAsL9B;IACK,iBAAiB,CACnB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,OAAO,aAAa,EAAE,kBAAkB,EACnD,kBAAkB,EAAE,MAAM,GAAG,IAAI,EACjC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAClC,OAAO,CAAC,mBAAmB,CAAC,CA0B9B;CACJ"}
|
|
@@ -217,6 +217,12 @@ class AgentTokenProvider {
|
|
|
217
217
|
if (!validateResponse(value) ||
|
|
218
218
|
value.refresh_token === slot.tokens.refreshToken)
|
|
219
219
|
throw reconnectError();
|
|
220
|
+
const refreshLifetime = value.refresh_expires_in;
|
|
221
|
+
if (typeof refreshLifetime !== 'number' ||
|
|
222
|
+
!Number.isSafeInteger(refreshLifetime) ||
|
|
223
|
+
refreshLifetime < 1 ||
|
|
224
|
+
refreshLifetime > 2147483647)
|
|
225
|
+
throw reconnectError();
|
|
220
226
|
const scopes = value.scope.split(' ');
|
|
221
227
|
const savedScopes = slot.tokens.scopes;
|
|
222
228
|
if (scopes.length !== slot.tokens.scopes.length ||
|
|
@@ -241,6 +247,11 @@ class AgentTokenProvider {
|
|
|
241
247
|
accessToken: value.access_token,
|
|
242
248
|
refreshToken: value.refresh_token,
|
|
243
249
|
accessTokenExpiresAt: new Date(expiresAt).toISOString(),
|
|
250
|
+
refreshTokenExpiresAt: new Date(Math.min(slot.tokens.refreshTokenExpiresAt ===
|
|
251
|
+
null
|
|
252
|
+
? Infinity
|
|
253
|
+
: Date.parse(slot.tokens
|
|
254
|
+
.refreshTokenExpiresAt), startedAt + refreshLifetime * 1000, serverTime + refreshLifetime * 1000, Date.parse(slot.grantExpiresAt))).toISOString(),
|
|
244
255
|
generation: slot.tokens.generation + 1,
|
|
245
256
|
lastRefreshAttemptUuid: attemptUuid,
|
|
246
257
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentConnectionSlot } from './schema';
|
|
2
|
+
export type ApprovedProjectProof = {
|
|
3
|
+
projectUuid: string;
|
|
4
|
+
slug: string | null;
|
|
5
|
+
};
|
|
6
|
+
export declare const parseApprovedProjectProof: (value: unknown) => ApprovedProjectProof[] | null;
|
|
7
|
+
export declare const matchesApprovedProjectProof: (projects: AgentConnectionSlot['lastReported']['approvedProjects'], proof: ApprovedProjectProof[] | null, requested: string[] | null) => boolean;
|
|
8
|
+
//# sourceMappingURL=approvedProjectProof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvedProjectProof.d.ts","sourceRoot":"","sources":["../../src/agentConnections/approvedProjectProof.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAChF,eAAO,MAAM,yBAAyB,UAC3B,OAAO,KACf,oBAAoB,EAAE,GAAG,IAiC3B,CAAC;AACF,eAAO,MAAM,2BAA2B,aAC1B,mBAAmB,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAC,SAC1D,oBAAoB,EAAE,GAAG,IAAI,aACzB,MAAM,EAAE,GAAG,IAAI,KAC3B,OA4BF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchesApprovedProjectProof = exports.parseApprovedProjectProof = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const parseApprovedProjectProof = (value) => {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return null;
|
|
8
|
+
if (!Array.isArray(value) || value.length > 500)
|
|
9
|
+
throw new Error('Invalid approved projects.');
|
|
10
|
+
const projects = value.map((item) => {
|
|
11
|
+
if (typeof item !== 'object' || item === null || Array.isArray(item))
|
|
12
|
+
throw new Error('Invalid approved projects.');
|
|
13
|
+
const entry = item;
|
|
14
|
+
if (typeof entry.project_uuid !== 'string' ||
|
|
15
|
+
!(0, uuid_1.validate)(entry.project_uuid) ||
|
|
16
|
+
(entry.slug !== null &&
|
|
17
|
+
(typeof entry.slug !== 'string' ||
|
|
18
|
+
entry.slug.length < 1 ||
|
|
19
|
+
entry.slug.length > 255 ||
|
|
20
|
+
/[\s/\\\u0000-\u001f\u007f?#]/.test(entry.slug))))
|
|
21
|
+
throw new Error('Invalid approved projects.');
|
|
22
|
+
return {
|
|
23
|
+
projectUuid: entry.project_uuid,
|
|
24
|
+
slug: entry.slug,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const slugs = projects.flatMap((project) => project.slug === null ? [] : [project.slug]);
|
|
28
|
+
if (new Set(projects.map((project) => project.projectUuid)).size !==
|
|
29
|
+
projects.length ||
|
|
30
|
+
new Set(slugs).size !== slugs.length)
|
|
31
|
+
throw new Error('Invalid approved projects.');
|
|
32
|
+
return projects;
|
|
33
|
+
};
|
|
34
|
+
exports.parseApprovedProjectProof = parseApprovedProjectProof;
|
|
35
|
+
const matchesApprovedProjectProof = (projects, proof, requested) => {
|
|
36
|
+
if (proof !== null &&
|
|
37
|
+
(proof.length !== projects.length ||
|
|
38
|
+
proof.some((entry) => !projects.some((project) => project.projectUuid === entry.projectUuid))))
|
|
39
|
+
return false;
|
|
40
|
+
if (requested === null)
|
|
41
|
+
return true;
|
|
42
|
+
const matches = projects.map((project) => requested.includes(project.projectUuid)
|
|
43
|
+
? project.projectUuid
|
|
44
|
+
: proof?.find((entry) => entry.projectUuid === project.projectUuid &&
|
|
45
|
+
entry.slug !== null &&
|
|
46
|
+
!(0, uuid_1.validate)(entry.slug))?.slug);
|
|
47
|
+
return (matches.every((match) => typeof match === 'string' && requested.includes(match)) && new Set(matches).size === matches.length);
|
|
48
|
+
};
|
|
49
|
+
exports.matchesApprovedProjectProof = matchesApprovedProjectProof;
|
|
@@ -13,11 +13,12 @@ export declare const exchangeInitialConnectionToken: ({ instanceUrl, code, verif
|
|
|
13
13
|
}) => Promise<{
|
|
14
14
|
grantUuid: string;
|
|
15
15
|
grantRevision: number | null;
|
|
16
|
+
approvedProjectProof: import("./approvedProjectProof").ApprovedProjectProof[] | null;
|
|
16
17
|
tokens: {
|
|
17
18
|
accessToken: string;
|
|
18
19
|
refreshToken: string;
|
|
19
20
|
accessTokenExpiresAt: string;
|
|
20
|
-
refreshTokenExpiresAt: string
|
|
21
|
+
refreshTokenExpiresAt: string;
|
|
21
22
|
scopes: string[];
|
|
22
23
|
generation: number;
|
|
23
24
|
lastRefreshAttemptUuid: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialToken.d.ts","sourceRoot":"","sources":["../../src/agentConnections/initialToken.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialToken.d.ts","sourceRoot":"","sources":["../../src/agentConnections/initialToken.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,qGACwE,CAAC;AACvG,qBAAa,oBAAqB,SAAQ,KAAK;IAC3C,YAAY,OAAO,SAAoB,EAEtC;CACJ;AACD,eAAO,MAAM,8BAA8B,yFAQxC;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;;;;;QA2EW,WAAW;QACX,YAAY;QACZ,oBAAoB;QAGpB,qBAAqB;QAGrB,MAAM;QACN,UAAU;QACV,sBAAsB;;EAGjC,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.exchangeInitialConnectionToken = exports.ConnectionProofError = exports.unboundConnection = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
const apiUrl_1 = require("./apiUrl");
|
|
6
|
+
const approvedProjectProof_1 = require("./approvedProjectProof");
|
|
6
7
|
const statusResponse_1 = require("./statusResponse");
|
|
7
8
|
exports.unboundConnection = 'The server returned a token that is not bound to this agent connection. No credential was saved.';
|
|
8
9
|
class ConnectionProofError extends Error {
|
|
@@ -45,7 +46,7 @@ const exchangeInitialConnectionToken = async ({ instanceUrl, code, verifier, red
|
|
|
45
46
|
throw new ConnectionProofError('The server did not identify an agent connection. No credential was saved.');
|
|
46
47
|
const revision = metadata?.grant_revision ?? null;
|
|
47
48
|
const lifetime = token.expires_in;
|
|
48
|
-
const refreshLifetime = token.refresh_expires_in
|
|
49
|
+
const refreshLifetime = token.refresh_expires_in;
|
|
49
50
|
if (typeof hint !== 'string' ||
|
|
50
51
|
!(0, uuid_1.validate)(hint) ||
|
|
51
52
|
(grantUuid !== null && (!(0, uuid_1.validate)(grantUuid) || grantUuid !== hint)) ||
|
|
@@ -64,11 +65,10 @@ const exchangeInitialConnectionToken = async ({ instanceUrl, code, verifier, red
|
|
|
64
65
|
!Number.isSafeInteger(lifetime) ||
|
|
65
66
|
lifetime < 1 ||
|
|
66
67
|
lifetime > 2147483647 ||
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
refreshLifetime > 2147483647)) ||
|
|
68
|
+
typeof refreshLifetime !== 'number' ||
|
|
69
|
+
!Number.isSafeInteger(refreshLifetime) ||
|
|
70
|
+
refreshLifetime < 1 ||
|
|
71
|
+
refreshLifetime > 2147483647 ||
|
|
72
72
|
typeof token.scope !== 'string' ||
|
|
73
73
|
!/^[\x21\x23-\x5b\x5d-\x7e]+(?: [\x21\x23-\x5b\x5d-\x7e]+)*$/.test(token.scope) ||
|
|
74
74
|
(token.resource !== undefined && token.resource !== instanceUrl) ||
|
|
@@ -77,13 +77,12 @@ const exchangeInitialConnectionToken = async ({ instanceUrl, code, verifier, red
|
|
|
77
77
|
return {
|
|
78
78
|
grantUuid: hint,
|
|
79
79
|
grantRevision: revision,
|
|
80
|
+
approvedProjectProof: (0, approvedProjectProof_1.parseApprovedProjectProof)(metadata?.approved_projects),
|
|
80
81
|
tokens: {
|
|
81
82
|
accessToken: token.access_token,
|
|
82
83
|
refreshToken: token.refresh_token,
|
|
83
84
|
accessTokenExpiresAt: new Date(startedAt + lifetime * 1000).toISOString(),
|
|
84
|
-
refreshTokenExpiresAt: refreshLifetime
|
|
85
|
-
? null
|
|
86
|
-
: new Date(startedAt + refreshLifetime * 1000).toISOString(),
|
|
85
|
+
refreshTokenExpiresAt: new Date(startedAt + refreshLifetime * 1000).toISOString(),
|
|
87
86
|
scopes: [...new Set(token.scope.split(' '))],
|
|
88
87
|
generation: 1,
|
|
89
88
|
lastRefreshAttemptUuid: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/agentConnections/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,MAAM,MAAM,OAAO,GAAG;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,2BAA2B,GACjC,eAAe,GACf,eAAe,GACf,SAAS,GACT,SAAS,GACT,yBAAyB,GACzB,gBAAgB,GAChB,mBAAmB,GACnB,cAAc,CAAC;AACrB,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG;IACxC,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,S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: 'string', format: 'uuid' };
|
|
|
30
30
|
const date = {
|
|
31
31
|
type: 'string',
|
|
32
32
|
format: 'date-time',
|
|
33
|
-
|
|
33
|
+
// No leap second: Date.parse cannot read ":60".
|
|
34
|
+
pattern: '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:[0-5]\\d\\.\\d{3}Z$',
|
|
34
35
|
};
|
|
35
36
|
const nullable = (schema) => ({ anyOf: [schema, { type: 'null' }] });
|
|
36
37
|
const object = (properties) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentConnectionConnect.d.ts","sourceRoot":"","sources":["../../src/handlers/agentConnectionConnect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agentConnectionConnect.d.ts","sourceRoot":"","sources":["../../src/handlers/agentConnectionConnect.ts"],"names":[],"mappings":"AASA,OAAO,EAEH,KAAK,wBAAwB,EAChC,MAAM,mCAAmC,CAAC;AA2G3C,eAAO,MAAM,6BAA6B,YAC7B,wBAAwB,iBACnB;IAAE,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,KAGnE,OAAO,CAAC,IAAI,CA6Xd,CAAC"}
|
|
@@ -6,6 +6,7 @@ const common_1 = require("@lightdash/common");
|
|
|
6
6
|
const crypto_1 = require("crypto");
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
8
8
|
const apiUrl_1 = require("../agentConnections/apiUrl");
|
|
9
|
+
const approvedProjectProof_1 = require("../agentConnections/approvedProjectProof");
|
|
9
10
|
const connectInputs_1 = require("../agentConnections/connectInputs");
|
|
10
11
|
const initialToken_1 = require("../agentConnections/initialToken");
|
|
11
12
|
const lifecycle_1 = require("../agentConnections/lifecycle");
|
|
@@ -276,25 +277,8 @@ const agentConnectionConnectHandler = async (options, dependencies = {
|
|
|
276
277
|
Date.parse(verified.approvedAt) > Date.now() ||
|
|
277
278
|
verified.lastReported.approvedProjects.some((project) => project.approvedCapabilities.some((capability) => !input.capabilities.includes(capability))))
|
|
278
279
|
throw new initialToken_1.ConnectionProofError();
|
|
279
|
-
if (input.projects
|
|
280
|
-
|
|
281
|
-
const projectMatches = await Promise.all(verified.lastReported.approvedProjects.map(async (project) => {
|
|
282
|
-
if (requestedProjects.includes(project.projectUuid))
|
|
283
|
-
return project.projectUuid;
|
|
284
|
-
const details = await proofResults(await fetch(`/api/v1/projects/${project.projectUuid}`, {
|
|
285
|
-
headers,
|
|
286
|
-
signal,
|
|
287
|
-
redirect: 'error',
|
|
288
|
-
}));
|
|
289
|
-
if (details.projectUuid !== project.projectUuid ||
|
|
290
|
-
typeof details.slug !== 'string' ||
|
|
291
|
-
!requestedProjects.includes(details.slug))
|
|
292
|
-
throw new initialToken_1.ConnectionProofError();
|
|
293
|
-
return details.slug;
|
|
294
|
-
}));
|
|
295
|
-
if (new Set(projectMatches).size !== projectMatches.length)
|
|
296
|
-
throw new initialToken_1.ConnectionProofError();
|
|
297
|
-
}
|
|
280
|
+
if (!(0, approvedProjectProof_1.matchesApprovedProjectProof)(verified.lastReported.approvedProjects, exchanged.approvedProjectProof, input.projects))
|
|
281
|
+
throw new initialToken_1.ConnectionProofError();
|
|
298
282
|
const subject = personIdentity(await proofResults(await fetch('/api/v1/user', {
|
|
299
283
|
headers,
|
|
300
284
|
signal,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.576.0",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@actions/core": "1.11.1",
|
|
23
23
|
"@aws-sdk/credential-providers": "3.995.0",
|
|
24
24
|
"@casl/ability": "6.8.0",
|
|
25
|
-
"@lightdash/common": "2.
|
|
26
|
-
"@lightdash/warehouses": "2.
|
|
25
|
+
"@lightdash/common": "2.576.0",
|
|
26
|
+
"@lightdash/warehouses": "2.576.0",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|