@pipeline-builder/pipeline-manager 6.1.2 → 6.2.1
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/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -3
- package/dist/commands/audit-stacks.d.ts.map +1 -1
- package/dist/commands/audit-stacks.js +3 -2
- package/dist/commands/create-pat.d.ts.map +1 -1
- package/dist/commands/create-pat.js +13 -6
- package/dist/commands/org-export.d.ts +4 -3
- package/dist/commands/org-export.d.ts.map +1 -1
- package/dist/commands/org-export.js +10 -5
- package/dist/commands/pipeline-execution.d.ts +65 -0
- package/dist/commands/pipeline-execution.d.ts.map +1 -0
- package/dist/commands/pipeline-execution.js +193 -0
- package/dist/commands/setup-runner.d.ts +129 -0
- package/dist/commands/setup-runner.d.ts.map +1 -0
- package/dist/commands/setup-runner.js +539 -0
- package/dist/commands/store-token.d.ts +11 -1
- package/dist/commands/store-token.d.ts.map +1 -1
- package/dist/commands/store-token.js +23 -11
- package/dist/commands/synth.d.ts.map +1 -1
- package/dist/commands/synth.js +12 -6
- package/dist/commands/version.d.ts.map +1 -1
- package/dist/commands/version.js +10 -6
- package/dist/lambda/pipeline-tag.d.ts +11 -0
- package/dist/lambda/pipeline-tag.d.ts.map +1 -0
- package/dist/lambda/pipeline-tag.js +28 -0
- package/dist/lambda/runner-handler.d.ts +112 -0
- package/dist/lambda/runner-handler.d.ts.map +1 -0
- package/dist/lambda/runner-handler.js +540 -0
- package/dist/lambda/runner-jws.d.ts +107 -0
- package/dist/lambda/runner-jws.d.ts.map +1 -0
- package/dist/lambda/runner-jws.js +269 -0
- package/dist/templates/runner-stack.json +349 -0
- package/dist/utils/command-utils.d.ts +8 -0
- package/dist/utils/command-utils.d.ts.map +1 -1
- package/dist/utils/command-utils.js +15 -1
- package/dist/utils/runner-template.d.ts +35 -0
- package/dist/utils/runner-template.d.ts.map +1 -0
- package/dist/utils/runner-template.js +101 -0
- package/dist/utils/service-account.d.ts +2 -0
- package/dist/utils/service-account.d.ts.map +1 -1
- package/dist/utils/service-account.js +2 -2
- package/package.json +6 -4
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
// src/lambda/runner-handler.ts
|
|
2
|
+
import {
|
|
3
|
+
CodePipelineClient,
|
|
4
|
+
GetPipelineExecutionCommand,
|
|
5
|
+
StartPipelineExecutionCommand,
|
|
6
|
+
StopPipelineExecutionCommand
|
|
7
|
+
} from "@aws-sdk/client-codepipeline";
|
|
8
|
+
import { GetResourcesCommand, ResourceGroupsTaggingAPIClient } from "@aws-sdk/client-resource-groups-tagging-api";
|
|
9
|
+
|
|
10
|
+
// ../api-core/lib/types/pipeline-runners.js
|
|
11
|
+
var PIPELINE_ID_TAG = "pb.pipeline-id";
|
|
12
|
+
var RUNNER_JWKS_PATH = "/api/pipelines/runner/jwks.json";
|
|
13
|
+
var RUNNER_ACTIONS = ["start", "stop", "probe", "ping", "status"];
|
|
14
|
+
var RUNNER_ERRORS = {
|
|
15
|
+
// -- The pipeline service's answers --
|
|
16
|
+
RUNNERS_UNAVAILABLE: { httpStatus: 409, retryable: false, category: "platform" },
|
|
17
|
+
NO_RUNNER: { httpStatus: 409, retryable: false, category: "platform" },
|
|
18
|
+
RUNNER_UNREACHABLE: { httpStatus: 409, retryable: false, category: "platform" },
|
|
19
|
+
PIPELINE_NOT_FOUND_IN_RUNNERS: { httpStatus: 404, retryable: false, category: "platform" },
|
|
20
|
+
AMBIGUOUS_RUNNER: { httpStatus: 409, retryable: false, category: "platform" },
|
|
21
|
+
RUNNER_PING_FAILED: { httpStatus: 422, retryable: false, category: "platform" },
|
|
22
|
+
RUNNER_REVOKED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
23
|
+
RUNNER_LIMIT: { httpStatus: 409, retryable: false, category: "platform" },
|
|
24
|
+
RUN_REQUEST_RATE_LIMITED: { httpStatus: 429, retryable: false, category: "platform" },
|
|
25
|
+
TOO_MANY_PENDING: { httpStatus: 429, retryable: false, category: "platform" },
|
|
26
|
+
RUNNER_UPDATE_REQUIRED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
27
|
+
RUNNER_PENDING: { httpStatus: 409, retryable: false, category: "platform" },
|
|
28
|
+
RUNNERS_NOT_ENABLED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
29
|
+
// -- A runner's answers --
|
|
30
|
+
SIGNATURE_INVALID: { httpStatus: 401, retryable: false, category: "runner" },
|
|
31
|
+
RUNNER_REFUSED: { httpStatus: 403, retryable: false, category: "runner" },
|
|
32
|
+
RUNNER_PERMISSION_DENIED: { httpStatus: 403, retryable: false, category: "runner" },
|
|
33
|
+
PIPELINE_NOT_FOUND: { httpStatus: 404, retryable: false, category: "runner" },
|
|
34
|
+
AMBIGUOUS_PIPELINE: { httpStatus: 409, retryable: false, category: "runner" },
|
|
35
|
+
PIPELINE_NOT_TAGGED: { httpStatus: 409, retryable: false, category: "runner" },
|
|
36
|
+
PIPELINE_IDENTITY_MISMATCH: { httpStatus: 409, retryable: false, category: "runner" },
|
|
37
|
+
/** The tagging index has not caught up with a fresh deploy (retried briefly). */
|
|
38
|
+
NOT_YET_VISIBLE: { httpStatus: 409, retryable: true, category: "runner" },
|
|
39
|
+
/** The runner holds this request in flight with no final result yet. */
|
|
40
|
+
DUPLICATE: { httpStatus: 409, retryable: true, category: "runner" },
|
|
41
|
+
/** Anything unexpected inside the runner (a 5xx; retried). */
|
|
42
|
+
RUNNER_ERROR: { httpStatus: 500, retryable: true, category: "runner" },
|
|
43
|
+
// -- Recorded by the platform --
|
|
44
|
+
/** Not delivered within the request's lifetime. */
|
|
45
|
+
RUN_REQUEST_EXPIRED: { httpStatus: null, retryable: false, category: "recorded" },
|
|
46
|
+
/** A discovery probe that found nothing (probe rows only). */
|
|
47
|
+
NO_MATCH: { httpStatus: null, retryable: false, category: "recorded" }
|
|
48
|
+
};
|
|
49
|
+
var RUNNER_ERROR_CODES = Object.keys(RUNNER_ERRORS);
|
|
50
|
+
var codesIn = (c) => RUNNER_ERROR_CODES.filter((k) => RUNNER_ERRORS[k].category === c);
|
|
51
|
+
var RUNNER_API_ERROR_CODES = codesIn("platform");
|
|
52
|
+
var RUNNER_REPLY_ERROR_CODES = codesIn("runner");
|
|
53
|
+
var RUN_REQUEST_TYP = "pb-run+jwt";
|
|
54
|
+
var RUN_REQUEST_ALG = "EdDSA";
|
|
55
|
+
var RUN_REQUEST_ISS = "pipeline-builder";
|
|
56
|
+
var RUN_REQUEST_TTL_MS = 6e5;
|
|
57
|
+
var RUN_REQUEST_MAX_LIFETIME_SECONDS = RUN_REQUEST_TTL_MS / 1e3;
|
|
58
|
+
var RUN_REQUEST_CLOCK_SKEW_SECONDS = 120;
|
|
59
|
+
|
|
60
|
+
// src/lambda/pipeline-tag.ts
|
|
61
|
+
import { ListTagsForResourceCommand } from "@aws-sdk/client-codepipeline";
|
|
62
|
+
async function readPipelineIdTag(cp, resourceArn) {
|
|
63
|
+
let nextToken;
|
|
64
|
+
do {
|
|
65
|
+
const out = await cp.send(new ListTagsForResourceCommand({ resourceArn, ...nextToken ? { nextToken } : {} }));
|
|
66
|
+
const tag = (out.tags ?? []).find((t) => t.key === PIPELINE_ID_TAG);
|
|
67
|
+
if (tag) return tag.value ?? "";
|
|
68
|
+
nextToken = out.nextToken || void 0;
|
|
69
|
+
} while (nextToken);
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/lambda/runner-jws.ts
|
|
74
|
+
import { createPublicKey, verify as cryptoVerify } from "node:crypto";
|
|
75
|
+
var JWKS_TTL_MS = 10 * 60 * 1e3;
|
|
76
|
+
var JWKS_MIN_REFETCH_MS = 60 * 1e3;
|
|
77
|
+
var REPLAY_WINDOW_MS = 15 * 60 * 1e3;
|
|
78
|
+
var SignatureError = class extends Error {
|
|
79
|
+
constructor(reason) {
|
|
80
|
+
super(reason);
|
|
81
|
+
this.name = "SignatureError";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var JwksUnavailableError = class extends Error {
|
|
85
|
+
constructor(reason) {
|
|
86
|
+
super(reason);
|
|
87
|
+
this.name = "JwksUnavailableError";
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var JwksCache = class {
|
|
91
|
+
constructor(url, fetchFn, now, timeoutMs = 5e3) {
|
|
92
|
+
this.url = url;
|
|
93
|
+
this.fetchFn = fetchFn;
|
|
94
|
+
this.now = now;
|
|
95
|
+
this.timeoutMs = timeoutMs;
|
|
96
|
+
}
|
|
97
|
+
url;
|
|
98
|
+
fetchFn;
|
|
99
|
+
now;
|
|
100
|
+
timeoutMs;
|
|
101
|
+
keys = /* @__PURE__ */ new Map();
|
|
102
|
+
fetchedAt = -Infinity;
|
|
103
|
+
lastAttemptAt = -Infinity;
|
|
104
|
+
/** The key for `kid`, or undefined when the platform does not publish it. */
|
|
105
|
+
async get(kid) {
|
|
106
|
+
const never = this.fetchedAt === -Infinity;
|
|
107
|
+
if (never || this.now() - this.fetchedAt >= JWKS_TTL_MS && this.mayRefetch()) await this.refresh();
|
|
108
|
+
const key = this.keys.get(kid);
|
|
109
|
+
if (key) return key;
|
|
110
|
+
if (this.mayRefetch()) {
|
|
111
|
+
await this.refresh();
|
|
112
|
+
return this.keys.get(kid);
|
|
113
|
+
}
|
|
114
|
+
return void 0;
|
|
115
|
+
}
|
|
116
|
+
mayRefetch() {
|
|
117
|
+
return this.now() - this.lastAttemptAt >= JWKS_MIN_REFETCH_MS;
|
|
118
|
+
}
|
|
119
|
+
async refresh() {
|
|
120
|
+
this.lastAttemptAt = this.now();
|
|
121
|
+
let body;
|
|
122
|
+
try {
|
|
123
|
+
const controller = new AbortController();
|
|
124
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
125
|
+
try {
|
|
126
|
+
const res = await this.fetchFn(this.url, { method: "GET", headers: { Accept: "application/json" }, redirect: "error", signal: controller.signal });
|
|
127
|
+
if (!res.ok) throw new Error(`JWKS endpoint answered ${res.status}`);
|
|
128
|
+
body = await res.json();
|
|
129
|
+
} finally {
|
|
130
|
+
clearTimeout(timer);
|
|
131
|
+
}
|
|
132
|
+
} catch (err) {
|
|
133
|
+
if (this.keys.size > 0) return;
|
|
134
|
+
throw new JwksUnavailableError(err instanceof Error ? err.message : String(err));
|
|
135
|
+
}
|
|
136
|
+
const next = /* @__PURE__ */ new Map();
|
|
137
|
+
const list = body?.keys;
|
|
138
|
+
for (const jwk of Array.isArray(list) ? list : []) {
|
|
139
|
+
if (!jwk || jwk.kty !== "OKP" || jwk.crv !== "Ed25519" || typeof jwk.x !== "string" || typeof jwk.kid !== "string") continue;
|
|
140
|
+
if (jwk.use !== void 0 && jwk.use !== "sig") continue;
|
|
141
|
+
if (jwk.alg !== void 0 && jwk.alg !== RUN_REQUEST_ALG) continue;
|
|
142
|
+
try {
|
|
143
|
+
next.set(jwk.kid, createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: jwk.x }, format: "jwk" }));
|
|
144
|
+
} catch {
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
this.keys = next;
|
|
148
|
+
this.fetchedAt = this.now();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
function b64urlJson(part, what) {
|
|
152
|
+
try {
|
|
153
|
+
const parsed = JSON.parse(Buffer.from(part, "base64url").toString("utf8"));
|
|
154
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("not an object");
|
|
155
|
+
return parsed;
|
|
156
|
+
} catch {
|
|
157
|
+
throw new SignatureError(`malformed ${what}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
var isNonEmptyString = (v) => typeof v === "string" && v.length > 0;
|
|
161
|
+
async function verifyRunRequest(jws, opts) {
|
|
162
|
+
if (typeof jws !== "string") throw new SignatureError("missing request");
|
|
163
|
+
const parts = jws.trim().split(".");
|
|
164
|
+
if (parts.length !== 3 || parts.some((p2) => !/^[A-Za-z0-9_-]+$/.test(p2))) throw new SignatureError("not a compact JWS");
|
|
165
|
+
const [h, p, s] = parts;
|
|
166
|
+
const header = b64urlJson(h, "header");
|
|
167
|
+
if (header.typ !== RUN_REQUEST_TYP) throw new SignatureError("wrong typ");
|
|
168
|
+
if (header.alg !== RUN_REQUEST_ALG) throw new SignatureError("wrong alg");
|
|
169
|
+
if (!isNonEmptyString(header.kid)) throw new SignatureError("missing kid");
|
|
170
|
+
if (header.crit !== void 0) throw new SignatureError("unsupported crit header");
|
|
171
|
+
const key = await opts.jwks.get(header.kid);
|
|
172
|
+
if (!key) throw new SignatureError("unknown kid");
|
|
173
|
+
const signature = Buffer.from(s, "base64url");
|
|
174
|
+
let valid = false;
|
|
175
|
+
try {
|
|
176
|
+
valid = signature.length === 64 && cryptoVerify(null, Buffer.from(`${h}.${p}`, "ascii"), key, signature);
|
|
177
|
+
} catch {
|
|
178
|
+
valid = false;
|
|
179
|
+
}
|
|
180
|
+
if (!valid) throw new SignatureError("bad signature");
|
|
181
|
+
const c = b64urlJson(p, "payload");
|
|
182
|
+
if (c.iss !== RUN_REQUEST_ISS) throw new SignatureError("wrong iss");
|
|
183
|
+
if (!isNonEmptyString(c.aud)) throw new SignatureError("missing aud");
|
|
184
|
+
if (!isNonEmptyString(c.jti)) throw new SignatureError("missing jti");
|
|
185
|
+
if (typeof c.iat !== "number" || typeof c.exp !== "number" || !Number.isFinite(c.iat) || !Number.isFinite(c.exp)) {
|
|
186
|
+
throw new SignatureError("missing iat/exp");
|
|
187
|
+
}
|
|
188
|
+
const nowSec = Math.floor(opts.now() / 1e3);
|
|
189
|
+
if (c.iat > nowSec + RUN_REQUEST_CLOCK_SKEW_SECONDS) throw new SignatureError("issued in the future");
|
|
190
|
+
if (c.exp <= nowSec - RUN_REQUEST_CLOCK_SKEW_SECONDS) throw new SignatureError("expired");
|
|
191
|
+
if (c.exp <= c.iat || c.exp - c.iat > RUN_REQUEST_MAX_LIFETIME_SECONDS) throw new SignatureError("lifetime out of range");
|
|
192
|
+
if (!RUNNER_ACTIONS.includes(c.action)) throw new SignatureError("unknown action");
|
|
193
|
+
if (!isNonEmptyString(c.requestedBy)) throw new SignatureError("missing requestedBy");
|
|
194
|
+
const action = c.action;
|
|
195
|
+
if (!opts.runnerId) throw new SignatureError("runner has no RUNNER_ID");
|
|
196
|
+
if (c.aud !== opts.runnerId) throw new SignatureError("wrong aud");
|
|
197
|
+
if (action !== "ping" && !isNonEmptyString(c.pipelineId)) throw new SignatureError("missing pipelineId");
|
|
198
|
+
if ((action === "stop" || action === "status") && !isNonEmptyString(c.executionId)) throw new SignatureError("missing executionId");
|
|
199
|
+
let hint;
|
|
200
|
+
if (c.hint !== void 0 && c.hint !== null) {
|
|
201
|
+
const raw = c.hint;
|
|
202
|
+
if (typeof raw !== "object" || !isNonEmptyString(raw.region) || !isNonEmptyString(raw.pipelineName)) {
|
|
203
|
+
throw new SignatureError("malformed hint");
|
|
204
|
+
}
|
|
205
|
+
hint = { region: raw.region, pipelineName: raw.pipelineName };
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
iss: c.iss,
|
|
209
|
+
aud: c.aud,
|
|
210
|
+
jti: c.jti,
|
|
211
|
+
iat: c.iat,
|
|
212
|
+
exp: c.exp,
|
|
213
|
+
action,
|
|
214
|
+
...isNonEmptyString(c.pipelineId) ? { pipelineId: c.pipelineId } : {},
|
|
215
|
+
...hint ? { hint } : {},
|
|
216
|
+
...isNonEmptyString(c.executionId) ? { executionId: c.executionId } : {},
|
|
217
|
+
requestedBy: c.requestedBy
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
var ReplayCache = class {
|
|
221
|
+
constructor(now) {
|
|
222
|
+
this.now = now;
|
|
223
|
+
}
|
|
224
|
+
now;
|
|
225
|
+
seen = /* @__PURE__ */ new Map();
|
|
226
|
+
/** `undefined` for a new jti (now recorded as in flight); else what is known about it. */
|
|
227
|
+
claim(jti) {
|
|
228
|
+
this.prune();
|
|
229
|
+
const prior = this.seen.get(jti);
|
|
230
|
+
if (prior) return prior;
|
|
231
|
+
this.seen.set(jti, { firstSeenAt: this.now() });
|
|
232
|
+
return void 0;
|
|
233
|
+
}
|
|
234
|
+
complete(jti, result) {
|
|
235
|
+
const entry = this.seen.get(jti);
|
|
236
|
+
if (entry) entry.result = result;
|
|
237
|
+
}
|
|
238
|
+
forget(jti) {
|
|
239
|
+
this.seen.delete(jti);
|
|
240
|
+
}
|
|
241
|
+
prune() {
|
|
242
|
+
const cutoff = this.now() - REPLAY_WINDOW_MS;
|
|
243
|
+
for (const [jti, entry] of this.seen) if (entry.firstSeenAt < cutoff) this.seen.delete(jti);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// src/lambda/runner-handler.ts
|
|
248
|
+
var MAX_BODY_BYTES = 16 * 1024;
|
|
249
|
+
var csv = (v) => (v ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
250
|
+
function configFromEnv(env = process.env) {
|
|
251
|
+
const platformBaseUrl = (env.PLATFORM_BASE_URL ?? "").trim().replace(/\/+$/, "");
|
|
252
|
+
if (!platformBaseUrl) throw new Error("PLATFORM_BASE_URL environment variable is required");
|
|
253
|
+
if (!/^https:\/\//.test(platformBaseUrl) && env.NODE_ENV === "production") {
|
|
254
|
+
throw new Error("PLATFORM_BASE_URL must be https");
|
|
255
|
+
}
|
|
256
|
+
const allowedRegions = csv(env.ALLOWED_REGIONS);
|
|
257
|
+
if (allowedRegions.length === 0) throw new Error("ALLOWED_REGIONS environment variable is required");
|
|
258
|
+
const allowedPrefixes = csv(env.ALLOWED_PIPELINE_PREFIXES);
|
|
259
|
+
if (allowedPrefixes.length === 0) throw new Error("ALLOWED_PIPELINE_PREFIXES environment variable is required");
|
|
260
|
+
return {
|
|
261
|
+
runnerId: env.RUNNER_ID?.trim() || void 0,
|
|
262
|
+
platformBaseUrl,
|
|
263
|
+
allowedRegions,
|
|
264
|
+
allowedPrefixes,
|
|
265
|
+
version: env.RUNNER_VERSION?.trim() || "0.0.0"
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function defaultLog(level, msg, data) {
|
|
269
|
+
const line = JSON.stringify({ level, msg, ...data });
|
|
270
|
+
if (level === "ERROR") console.error(line);
|
|
271
|
+
else console.log(line);
|
|
272
|
+
}
|
|
273
|
+
function defaultDeps() {
|
|
274
|
+
const tagging = /* @__PURE__ */ new Map();
|
|
275
|
+
const cp = /* @__PURE__ */ new Map();
|
|
276
|
+
return {
|
|
277
|
+
fetch: (url, init) => fetch(url, init),
|
|
278
|
+
now: () => Date.now(),
|
|
279
|
+
tagging: (region) => {
|
|
280
|
+
if (!tagging.has(region)) tagging.set(region, new ResourceGroupsTaggingAPIClient({ region }));
|
|
281
|
+
return tagging.get(region);
|
|
282
|
+
},
|
|
283
|
+
codepipeline: (region) => {
|
|
284
|
+
if (!cp.has(region)) cp.set(region, new CodePipelineClient({ region }));
|
|
285
|
+
return cp.get(region);
|
|
286
|
+
},
|
|
287
|
+
log: defaultLog
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function accountFromFunctionArn(arn) {
|
|
291
|
+
const m = /^arn:([a-z-]+):lambda:[a-z0-9-]+:(\d{12}):function:/.exec(arn ?? "");
|
|
292
|
+
return m ? { partition: m[1], accountId: m[2] } : void 0;
|
|
293
|
+
}
|
|
294
|
+
function parsePipelineArn(arn) {
|
|
295
|
+
const parts = arn.split(":");
|
|
296
|
+
if (parts.length < 6 || parts[0] !== "arn" || parts[2] !== "codepipeline") return void 0;
|
|
297
|
+
const name = parts.slice(5).join(":");
|
|
298
|
+
if (!parts[3] || !name) return void 0;
|
|
299
|
+
return { region: parts[3], accountId: parts[4] ?? "", name };
|
|
300
|
+
}
|
|
301
|
+
function isAllowed(config, region, name) {
|
|
302
|
+
if (!config.allowedRegions.includes(region)) return false;
|
|
303
|
+
return config.allowedPrefixes.some((p) => p === "*" || name.startsWith(p));
|
|
304
|
+
}
|
|
305
|
+
var errName = (err) => String(err?.name ?? "");
|
|
306
|
+
var errStatus = (err) => err?.$metadata?.httpStatusCode;
|
|
307
|
+
function isAccessDenied(err) {
|
|
308
|
+
const n = errName(err);
|
|
309
|
+
return n === "AccessDeniedException" || n === "AccessDenied" || n === "UnauthorizedOperation" || n === "AuthorizationErrorException" || errStatus(err) === 403 && !/Throttl/.test(n);
|
|
310
|
+
}
|
|
311
|
+
var NOT_FOUND_ERRORS = /* @__PURE__ */ new Set(["ResourceNotFoundException", "PipelineNotFoundException", "InvalidArnException"]);
|
|
312
|
+
async function arnsByTag(config, deps, pipelineId, hintRegion) {
|
|
313
|
+
const regions = hintRegion && config.allowedRegions.includes(hintRegion) ? [hintRegion, ...config.allowedRegions.filter((r) => r !== hintRegion)] : [...config.allowedRegions];
|
|
314
|
+
const arns = [];
|
|
315
|
+
for (const region of regions) {
|
|
316
|
+
let token;
|
|
317
|
+
do {
|
|
318
|
+
const out = await deps.tagging(region).send(new GetResourcesCommand({
|
|
319
|
+
TagFilters: [{ Key: PIPELINE_ID_TAG, Values: [pipelineId] }],
|
|
320
|
+
ResourceTypeFilters: ["codepipeline:pipeline"],
|
|
321
|
+
...token ? { PaginationToken: token } : {}
|
|
322
|
+
}));
|
|
323
|
+
for (const m of out.ResourceTagMappingList ?? []) {
|
|
324
|
+
if (!m.ResourceARN) continue;
|
|
325
|
+
if (m.Tags && !m.Tags.some((t) => t.Key === PIPELINE_ID_TAG && t.Value === pipelineId)) continue;
|
|
326
|
+
const parsed = parsePipelineArn(m.ResourceARN);
|
|
327
|
+
if (parsed && parsed.region === region && !arns.includes(m.ResourceARN)) arns.push(m.ResourceARN);
|
|
328
|
+
}
|
|
329
|
+
token = out.PaginationToken || void 0;
|
|
330
|
+
} while (token);
|
|
331
|
+
}
|
|
332
|
+
return arns;
|
|
333
|
+
}
|
|
334
|
+
async function hintedTag(deps, account, hint) {
|
|
335
|
+
const resourceArn = `arn:${account.partition}:codepipeline:${hint.region}:${account.accountId}:${hint.pipelineName}`;
|
|
336
|
+
try {
|
|
337
|
+
return await readPipelineIdTag(deps.codepipeline(hint.region), resourceArn) ?? null;
|
|
338
|
+
} catch (err) {
|
|
339
|
+
if (NOT_FOUND_ERRORS.has(errName(err))) return void 0;
|
|
340
|
+
throw err;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async function findPipeline(config, deps, account, pipelineId, hint) {
|
|
344
|
+
const arns = await arnsByTag(config, deps, pipelineId, hint?.region);
|
|
345
|
+
if (arns.length > 1) return { kind: "ambiguous" };
|
|
346
|
+
if (arns.length === 1) {
|
|
347
|
+
const p = parsePipelineArn(arns[0]);
|
|
348
|
+
return { kind: "found", region: p.region, name: p.name, via: "tag" };
|
|
349
|
+
}
|
|
350
|
+
if (!hint) return { kind: "none" };
|
|
351
|
+
if (!isAllowed(config, hint.region, hint.pipelineName)) return { kind: "hint_refused" };
|
|
352
|
+
if (!account) return { kind: "none" };
|
|
353
|
+
const tag = await hintedTag(deps, account, hint);
|
|
354
|
+
if (tag === void 0) return { kind: "gone" };
|
|
355
|
+
if (tag === null) return { kind: "not_tagged" };
|
|
356
|
+
if (tag !== pipelineId) return { kind: "mismatch" };
|
|
357
|
+
return { kind: "found", region: hint.region, name: hint.pipelineName, via: "hint" };
|
|
358
|
+
}
|
|
359
|
+
var LOOKUP_REFUSALS = {
|
|
360
|
+
none: "NOT_YET_VISIBLE",
|
|
361
|
+
gone: "PIPELINE_NOT_FOUND",
|
|
362
|
+
ambiguous: "AMBIGUOUS_PIPELINE",
|
|
363
|
+
not_tagged: "PIPELINE_NOT_TAGGED",
|
|
364
|
+
mismatch: "PIPELINE_IDENTITY_MISMATCH",
|
|
365
|
+
hint_refused: "RUNNER_REFUSED"
|
|
366
|
+
};
|
|
367
|
+
function isFinal(r) {
|
|
368
|
+
if (r.status >= 500) return false;
|
|
369
|
+
return !("errorCode" in r.body && r.body.errorCode === "NOT_YET_VISIBLE");
|
|
370
|
+
}
|
|
371
|
+
function createRunner(config, deps) {
|
|
372
|
+
const jwks = new JwksCache(`${config.platformBaseUrl}${RUNNER_JWKS_PATH}`, deps.fetch, deps.now);
|
|
373
|
+
const replay = new ReplayCache(deps.now);
|
|
374
|
+
const ok = (outcome, extra = {}) => ({ status: 200, body: { outcome, ...extra, runnerVersion: config.version } });
|
|
375
|
+
const fail = (errorCode) => ({ status: RUNNER_ERRORS[errorCode].httpStatus, body: { errorCode, runnerVersion: config.version } });
|
|
376
|
+
const internal = () => ({ status: RUNNER_ERRORS.RUNNER_ERROR.httpStatus, body: { errorCode: "RUNNER_ERROR" } });
|
|
377
|
+
async function readExecution(cp, pipelineName, executionId) {
|
|
378
|
+
try {
|
|
379
|
+
const got = await cp.send(new GetPipelineExecutionCommand({ pipelineName, pipelineExecutionId: executionId }));
|
|
380
|
+
const e = got.pipelineExecution;
|
|
381
|
+
if (e?.pipelineName !== void 0 && e.pipelineName !== pipelineName) return fail("RUNNER_REFUSED");
|
|
382
|
+
return { ...e?.status ? { executionStatus: e.status } : {} };
|
|
383
|
+
} catch (err) {
|
|
384
|
+
if (errName(err) === "PipelineNotFoundException") return fail("PIPELINE_NOT_FOUND");
|
|
385
|
+
if (errName(err) === "PipelineExecutionNotFoundException") return fail("RUNNER_REFUSED");
|
|
386
|
+
throw err;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const isResult = (v) => "body" in v;
|
|
390
|
+
async function start(cp, name, claims) {
|
|
391
|
+
try {
|
|
392
|
+
const out = await cp.send(new StartPipelineExecutionCommand({
|
|
393
|
+
name,
|
|
394
|
+
// The request id: a redelivered request starts ONE execution, not two.
|
|
395
|
+
clientRequestToken: claims.jti
|
|
396
|
+
}));
|
|
397
|
+
return ok("started", out.pipelineExecutionId ? { executionId: out.pipelineExecutionId } : {});
|
|
398
|
+
} catch (err) {
|
|
399
|
+
if (errName(err) === "PipelineNotFoundException") return fail("PIPELINE_NOT_FOUND");
|
|
400
|
+
throw err;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
async function stop(cp, name, claims) {
|
|
404
|
+
const executionId = claims.executionId;
|
|
405
|
+
const execution = await readExecution(cp, name, executionId);
|
|
406
|
+
if (isResult(execution)) return execution;
|
|
407
|
+
if (execution.executionStatus === "Stopping" || execution.executionStatus === "Stopped") return ok("stopped", { executionId });
|
|
408
|
+
try {
|
|
409
|
+
await cp.send(new StopPipelineExecutionCommand({
|
|
410
|
+
pipelineName: name,
|
|
411
|
+
pipelineExecutionId: executionId,
|
|
412
|
+
abandon: false,
|
|
413
|
+
reason: `Stopped by pipeline-builder request ${claims.jti}`.slice(0, 200)
|
|
414
|
+
}));
|
|
415
|
+
} catch (err) {
|
|
416
|
+
const n = errName(err);
|
|
417
|
+
if (n === "DuplicatedStopRequestException") return ok("stopped", { executionId });
|
|
418
|
+
if (n === "PipelineNotFoundException") return fail("PIPELINE_NOT_FOUND");
|
|
419
|
+
if (n === "PipelineExecutionNotStoppableException" || n === "PipelineExecutionNotFoundException") return fail("RUNNER_REFUSED");
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
return ok("stopped", { executionId });
|
|
423
|
+
}
|
|
424
|
+
async function executionStatus(cp, name, claims) {
|
|
425
|
+
const execution = await readExecution(cp, name, claims.executionId);
|
|
426
|
+
if (isResult(execution)) return execution;
|
|
427
|
+
return ok("status", { executionId: claims.executionId, executionStatus: execution.executionStatus ?? "Unknown" });
|
|
428
|
+
}
|
|
429
|
+
async function act(claims, account) {
|
|
430
|
+
if (claims.action === "ping") return ok("pong", { regions: [...config.allowedRegions] });
|
|
431
|
+
const found = await findPipeline(config, deps, account, claims.pipelineId, claims.hint);
|
|
432
|
+
if (claims.action === "probe") {
|
|
433
|
+
if (found.kind === "ambiguous") return fail("AMBIGUOUS_PIPELINE");
|
|
434
|
+
return found.kind === "found" && isAllowed(config, found.region, found.name) ? ok("match") : ok("no_match");
|
|
435
|
+
}
|
|
436
|
+
if (found.kind !== "found") return fail(LOOKUP_REFUSALS[found.kind]);
|
|
437
|
+
if (!isAllowed(config, found.region, found.name)) return fail("RUNNER_REFUSED");
|
|
438
|
+
const cp = deps.codepipeline(found.region);
|
|
439
|
+
if (claims.action === "start") return start(cp, found.name, claims);
|
|
440
|
+
if (claims.action === "stop") return stop(cp, found.name, claims);
|
|
441
|
+
return executionStatus(cp, found.name, claims);
|
|
442
|
+
}
|
|
443
|
+
async function handleRequest(jws, opts = {}) {
|
|
444
|
+
let claims;
|
|
445
|
+
try {
|
|
446
|
+
claims = await verifyRunRequest(jws, { jwks, runnerId: config.runnerId, now: deps.now });
|
|
447
|
+
} catch (err) {
|
|
448
|
+
if (err instanceof SignatureError) {
|
|
449
|
+
deps.log("WARN", "Rejected a request that is not validly signed for this runner", { reason: err.message });
|
|
450
|
+
return fail("SIGNATURE_INVALID");
|
|
451
|
+
}
|
|
452
|
+
if (err instanceof JwksUnavailableError) {
|
|
453
|
+
deps.log("ERROR", "Could not fetch the platform signing keys", { reason: err.message });
|
|
454
|
+
return internal();
|
|
455
|
+
}
|
|
456
|
+
deps.log("ERROR", "Unexpected verification failure", { error: errName(err) || "Error" });
|
|
457
|
+
return internal();
|
|
458
|
+
}
|
|
459
|
+
const prior = replay.claim(claims.jti);
|
|
460
|
+
if (prior) {
|
|
461
|
+
deps.log("INFO", "Repeated request", { requestId: claims.jti, replayed: !!prior.result });
|
|
462
|
+
return prior.result ?? fail("DUPLICATE");
|
|
463
|
+
}
|
|
464
|
+
const logCtx = { requestId: claims.jti, requestedBy: claims.requestedBy, action: claims.action, ...claims.pipelineId ? { pipelineId: claims.pipelineId } : {} };
|
|
465
|
+
let result;
|
|
466
|
+
try {
|
|
467
|
+
result = await act(claims, opts.account);
|
|
468
|
+
} catch (err) {
|
|
469
|
+
if (isAccessDenied(err)) {
|
|
470
|
+
deps.log("ERROR", "The runner role was refused by AWS \u2014 redeploy the runner stack or fix its role", { ...logCtx, error: errName(err) });
|
|
471
|
+
result = fail("RUNNER_PERMISSION_DENIED");
|
|
472
|
+
} else {
|
|
473
|
+
deps.log("ERROR", "Request failed", { ...logCtx, error: errName(err) || "Error" });
|
|
474
|
+
result = internal();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (isFinal(result)) replay.complete(claims.jti, result);
|
|
478
|
+
else replay.forget(claims.jti);
|
|
479
|
+
const b = result.body;
|
|
480
|
+
deps.log("INFO", "Request handled", { ...logCtx, status: result.status, outcome: b.outcome ?? b.errorCode, ...b.executionId ? { executionId: b.executionId } : {} });
|
|
481
|
+
return result;
|
|
482
|
+
}
|
|
483
|
+
async function handleHttp(event, account) {
|
|
484
|
+
const respond = (r) => ({
|
|
485
|
+
statusCode: r.status,
|
|
486
|
+
headers: { "content-type": "application/json", "cache-control": "no-store" },
|
|
487
|
+
body: JSON.stringify(r.body)
|
|
488
|
+
});
|
|
489
|
+
const method = event.requestContext?.http?.method ?? event.httpMethod;
|
|
490
|
+
const contentType = Object.entries(event.headers ?? {}).find(([k]) => k.toLowerCase() === "content-type")?.[1] ?? "";
|
|
491
|
+
const raw = event.body ?? "";
|
|
492
|
+
const body = event.isBase64Encoded ? Buffer.from(raw, "base64").toString("utf8") : raw;
|
|
493
|
+
if (method !== "POST" || !/^application\/jwt\s*(;|$)/i.test(contentType) || !body || Buffer.byteLength(body) > MAX_BODY_BYTES) {
|
|
494
|
+
return respond(fail("SIGNATURE_INVALID"));
|
|
495
|
+
}
|
|
496
|
+
return respond(await handleRequest(body, { account }));
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
process: handleRequest,
|
|
500
|
+
async handler(event, context) {
|
|
501
|
+
const account = accountFromFunctionArn(context?.invokedFunctionArn);
|
|
502
|
+
if (isHttpEvent(event)) return handleHttp(event, account);
|
|
503
|
+
deps.log("WARN", "Ignoring an invocation that is not an HTTP request");
|
|
504
|
+
return { statusCode: 400 };
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function isHttpEvent(e) {
|
|
509
|
+
const ev = e;
|
|
510
|
+
return !!ev && typeof ev === "object" && (typeof ev.requestContext?.http?.method === "string" || typeof ev.httpMethod === "string");
|
|
511
|
+
}
|
|
512
|
+
var instance;
|
|
513
|
+
var handler = async (event, context) => {
|
|
514
|
+
if (!instance) {
|
|
515
|
+
let config;
|
|
516
|
+
try {
|
|
517
|
+
config = configFromEnv();
|
|
518
|
+
} catch (err) {
|
|
519
|
+
defaultLog("ERROR", "Runner misconfigured", { error: err instanceof Error ? err.message : String(err) });
|
|
520
|
+
return { statusCode: 500, headers: { "content-type": "application/json" }, body: JSON.stringify({ errorCode: "RUNNER_ERROR" }) };
|
|
521
|
+
}
|
|
522
|
+
instance = createRunner(config, defaultDeps());
|
|
523
|
+
}
|
|
524
|
+
return instance.handler(event, context);
|
|
525
|
+
};
|
|
526
|
+
function _resetRunnerForTests() {
|
|
527
|
+
instance = void 0;
|
|
528
|
+
}
|
|
529
|
+
export {
|
|
530
|
+
_resetRunnerForTests,
|
|
531
|
+
accountFromFunctionArn,
|
|
532
|
+
configFromEnv,
|
|
533
|
+
createRunner,
|
|
534
|
+
defaultDeps,
|
|
535
|
+
findPipeline,
|
|
536
|
+
handler,
|
|
537
|
+
isAccessDenied,
|
|
538
|
+
isAllowed,
|
|
539
|
+
parsePipelineArn
|
|
540
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification of the platform's SIGNED RUN REQUEST — the one thing that lets a
|
|
3
|
+
* runner sitting behind a public Function URL trust what arrives there.
|
|
4
|
+
*
|
|
5
|
+
* Format: a compact JWS, `alg: EdDSA` (Ed25519), header
|
|
6
|
+
* `{ alg: 'EdDSA', typ: 'pb-run+jwt', kid }`, signed by the pipeline service's
|
|
7
|
+
* DEDICATED runner-signing key (never the platform's user-token key). Public keys
|
|
8
|
+
* are served, unauthenticated, at `<PLATFORM_BASE_URL>/api/pipelines/runner/jwks.json`.
|
|
9
|
+
*
|
|
10
|
+
* Every check fails CLOSED with {@link SignatureError} (→ 401 SIGNATURE_INVALID),
|
|
11
|
+
* and all of them run before any AWS call. Node built-ins plus the
|
|
12
|
+
* dependency-free contract catalog (`@pipeline-builder/api-core/pipeline-runners`,
|
|
13
|
+
* inlined by the bundler), so the bundled Lambda stays one self-contained file.
|
|
14
|
+
*/
|
|
15
|
+
import { type KeyObject } from 'node:crypto';
|
|
16
|
+
import { type RunClaims } from '@pipeline-builder/api-core/pipeline-runners';
|
|
17
|
+
/** The claims a run request carries — the shared contract's. */
|
|
18
|
+
export type { RunClaims };
|
|
19
|
+
/** How long a fetched key set is trusted before it is fetched again. */
|
|
20
|
+
export declare const JWKS_TTL_MS: number;
|
|
21
|
+
/** An unknown `kid` refetches the key set at most this often. */
|
|
22
|
+
export declare const JWKS_MIN_REFETCH_MS: number;
|
|
23
|
+
/** A seen `jti` is remembered this long (longer than any request can live). */
|
|
24
|
+
export declare const REPLAY_WINDOW_MS: number;
|
|
25
|
+
/** A request that is not a valid platform-signed request for this runner. */
|
|
26
|
+
export declare class SignatureError extends Error {
|
|
27
|
+
constructor(reason: string);
|
|
28
|
+
}
|
|
29
|
+
/** The key set could not be fetched (and none is cached) — a runner-side failure, not a bad request. */
|
|
30
|
+
export declare class JwksUnavailableError extends Error {
|
|
31
|
+
constructor(reason: string);
|
|
32
|
+
}
|
|
33
|
+
export type FetchFn = (url: string, init?: {
|
|
34
|
+
method?: string;
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
redirect?: 'error';
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}) => Promise<{
|
|
39
|
+
status: number;
|
|
40
|
+
ok: boolean;
|
|
41
|
+
json(): Promise<unknown>;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* The platform's runner-signing public keys, fetched from its JWKS endpoint and
|
|
45
|
+
* cached: trusted for {@link JWKS_TTL_MS}, refetched early when a request names
|
|
46
|
+
* an unknown `kid` (a key rotation), but at most once per
|
|
47
|
+
* {@link JWKS_MIN_REFETCH_MS} so a flood of bogus kids cannot turn the runner
|
|
48
|
+
* into a fetch amplifier. The same throttle applies to a refresh that failed
|
|
49
|
+
* while keys are cached. Redirects are refused: keys come from the configured
|
|
50
|
+
* URL only.
|
|
51
|
+
*/
|
|
52
|
+
export declare class JwksCache {
|
|
53
|
+
private readonly url;
|
|
54
|
+
private readonly fetchFn;
|
|
55
|
+
private readonly now;
|
|
56
|
+
private readonly timeoutMs;
|
|
57
|
+
private keys;
|
|
58
|
+
private fetchedAt;
|
|
59
|
+
private lastAttemptAt;
|
|
60
|
+
constructor(url: string, fetchFn: FetchFn, now: () => number, timeoutMs?: number);
|
|
61
|
+
/** The key for `kid`, or undefined when the platform does not publish it. */
|
|
62
|
+
get(kid: string): Promise<KeyObject | undefined>;
|
|
63
|
+
private mayRefetch;
|
|
64
|
+
private refresh;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Verify a compact JWS run request and return its claims.
|
|
68
|
+
*
|
|
69
|
+
* `runnerId` is this runner's own id (`aud` must equal it). The CLI registers
|
|
70
|
+
* the runner BEFORE deploying it, so the id is always in the stack; a runner
|
|
71
|
+
* without one refuses everything — there is no "unbound" mode.
|
|
72
|
+
*/
|
|
73
|
+
export declare function verifyRunRequest(jws: string, opts: {
|
|
74
|
+
jwks: Pick<JwksCache, 'get'>;
|
|
75
|
+
runnerId?: string;
|
|
76
|
+
now: () => number;
|
|
77
|
+
}): Promise<RunClaims>;
|
|
78
|
+
/** A remembered request: its final result once known. */
|
|
79
|
+
interface Seen<R> {
|
|
80
|
+
firstSeenAt: number;
|
|
81
|
+
result?: R;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The in-memory `jti` replay guard. A repeat of a request whose FINAL result is
|
|
85
|
+
* known gets that result back (delivery is at least once, so a retry after a
|
|
86
|
+
* lost response must not act twice); a repeat while the first is still in
|
|
87
|
+
* flight is a DUPLICATE. Transient outcomes are {@link forget}-ed so the
|
|
88
|
+
* platform's retry is processed afresh.
|
|
89
|
+
*
|
|
90
|
+
* Best effort only: the cache lives in ONE warm container, and the function
|
|
91
|
+
* runs up to two (reserved concurrency 2) and is recycled at will, so a
|
|
92
|
+
* redelivery can land where the jti was never seen. Correctness does not rest
|
|
93
|
+
* on it: a start passes the jti as CodePipeline's `clientRequestToken` (the
|
|
94
|
+
* real idempotency guard: the same request starts one execution), and a stop of
|
|
95
|
+
* an execution already stopping/stopped answers `stopped`.
|
|
96
|
+
*/
|
|
97
|
+
export declare class ReplayCache<R> {
|
|
98
|
+
private readonly now;
|
|
99
|
+
private seen;
|
|
100
|
+
constructor(now: () => number);
|
|
101
|
+
/** `undefined` for a new jti (now recorded as in flight); else what is known about it. */
|
|
102
|
+
claim(jti: string): Seen<R> | undefined;
|
|
103
|
+
complete(jti: string, result: R): void;
|
|
104
|
+
forget(jti: string): void;
|
|
105
|
+
private prune;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=runner-jws.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-jws.d.ts","sources":["../../src/lambda/runner-jws.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,6CAA6C,CAAC;AAErD,gEAAgE;AAChE,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,wEAAwE;AACxE,eAAO,MAAM,WAAW,QAAiB,CAAC;AAC1C,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,QAAY,CAAC;AAC7C,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,QAAiB,CAAC;AAE/C,6EAA6E;AAC7E,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,MAAM,EAAE,MAAM,EAGzB;CACF;AAED,wGAAwG;AACxG,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,MAAM,EAAE,MAAM,EAGzB;CACF;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAAK,OAAO,CAAC;IACrJ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B,CAAC,CAAC;AAWH;;;;;;;;GAQG;AACH,qBAAa,SAAS;IAMlB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAR5B,OAAO,CAAC,IAAI,CAAgC;IAC5C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,aAAa,CAAa;IAElC,YACmB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,MAAM,EACjB,SAAS,SAAQ,EAChC;IAEJ,6EAA6E;IACvE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAarD;IAED,OAAO,CAAC,UAAU;YAIJ,OAAO;CAmCtB;AAcD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,MAAM,CAAA;CAAE,GAC3E,OAAO,CAAC,SAAS,CAAC,CAiEpB;AAED,yDAAyD;AACzD,UAAU,IAAI,CAAC,CAAC;IAAI,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,CAAC,CAAA;CAAE;AAErD;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAW,CAAC,CAAC;IAGZ,OAAO,CAAC,QAAQ,CAAC,GAAG;IAFhC,OAAO,CAAC,IAAI,CAA8B;IAE1C,YAA6B,GAAG,EAAE,MAAM,MAAM,EAAI;IAElD,0FAA0F;IAC1F,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,CAMtC;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAGrC;IAED,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExB;IAED,OAAO,CAAC,KAAK;CAId"}
|