cdk-local 0.151.0 → 0.152.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.
@@ -1,5 +1,5 @@
1
- import { C as sanitizeServiceExceptionMessage, S as isAwsServiceException, _ as resolveAssemblyPath, a as isDockerClientEnvKey, b as describeCredentialLoadFailure, c as runDockerStreaming, d as absoluteAssemblyPathEscape, f as assemblyPathEscape, g as renderAssemblyPathEscape, h as namesTheSameDirectory, i as getDockerCmd, l as spawnStreaming, m as isPasteableCommandArg, n as finchSecretArgvRefusal, o as isMalformedEnvKey, p as displayUntrustedValue, r as formatDockerLoginError, s as runDockerForeground, u as warnFinchArgvExposure, v as clampErrorName, w as stringifyThrown, x as flattenToOneLine, y as describeAwsFailureForWarn } from "./docker-cmd-GME6jkl9.js";
2
- import { a as setEmbedConfig, r as getEmbedConfig, t as getLogger } from "./logger-CGhtqHg0.js";
1
+ import { C as sanitizeServiceExceptionMessage, S as isAwsServiceException, _ as resolveAssemblyPath, a as isDockerClientEnvKey, b as describeCredentialLoadFailure, c as runDockerStreaming, d as absoluteAssemblyPathEscape, f as assemblyPathEscape, g as renderAssemblyPathEscape, h as namesTheSameDirectory, i as getDockerCmd, l as spawnStreaming, m as isPasteableCommandArg, n as finchSecretArgvRefusal, o as isMalformedEnvKey, p as displayUntrustedValue, r as formatDockerLoginError, s as runDockerForeground, u as warnFinchArgvExposure, v as clampErrorName, w as stringifyThrown, x as flattenToOneLine, y as describeAwsFailureForWarn } from "./docker-cmd-BSdu45mc.js";
2
+ import { a as setEmbedConfig, r as getEmbedConfig, t as getLogger } from "./logger-CwFXOD1w.js";
3
3
  import { chmodSync, cpSync, createWriteStream, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { homedir, tmpdir } from "node:os";
5
5
  import * as path$1 from "node:path";
@@ -358,6 +358,120 @@ function buildStsClientConfig(args) {
358
358
  };
359
359
  }
360
360
 
361
+ //#endregion
362
+ //#region src/utils/workload-identity.ts
363
+ let record;
364
+ let stripWarned = false;
365
+ const SECOND_ASSUME_MESSAGE = "A role was already assumed in this process; refusing to assume a second one. Pass --role-arn once.";
366
+ function recordAssumedRole(caller) {
367
+ if (record !== void 0) throw new Error(SECOND_ASSUME_MESSAGE);
368
+ record = { caller: caller ? {
369
+ accessKeyId: caller.accessKeyId,
370
+ secretAccessKey: caller.secretAccessKey,
371
+ ...caller.sessionToken ? { sessionToken: caller.sessionToken } : {}
372
+ } : void 0 };
373
+ }
374
+ function assumedRoleRecorded() {
375
+ return record !== void 0;
376
+ }
377
+ function readEnvCallerCredentials(env = process.env) {
378
+ const accessKeyId = env["AWS_ACCESS_KEY_ID"];
379
+ const secretAccessKey = env["AWS_SECRET_ACCESS_KEY"];
380
+ if (!accessKeyId || !secretAccessKey) return void 0;
381
+ const sessionToken = env["AWS_SESSION_TOKEN"];
382
+ return {
383
+ accessKeyId,
384
+ secretAccessKey,
385
+ ...sessionToken ? { sessionToken } : {}
386
+ };
387
+ }
388
+ function resetWorkloadIdentity() {
389
+ record = void 0;
390
+ stripWarned = false;
391
+ }
392
+ function callerRecord() {
393
+ return getEmbedConfig().workloadIdentity === "caller" ? record : void 0;
394
+ }
395
+ const MULTIPLE_CREDENTIAL_SOURCES_WARNING = "Multiple credential sources detected";
396
+ const chainLogger = {
397
+ debug: () => {},
398
+ info: () => {},
399
+ warn: (...args) => {
400
+ const text = args.map(String).join(" ");
401
+ if (text.includes(MULTIPLE_CREDENTIAL_SOURCES_WARNING)) return;
402
+ getLogger().warn(text);
403
+ },
404
+ error: (...args) => {
405
+ getLogger().error(args.map(String).join(" "));
406
+ }
407
+ };
408
+ function callerChainWithoutEnv(proxied) {
409
+ let chain;
410
+ return async (identityProperties) => {
411
+ chain ??= (async () => {
412
+ const { defaultProvider } = await import("@aws-sdk/credential-provider-node");
413
+ return defaultProvider({
414
+ profile: "default",
415
+ logger: chainLogger,
416
+ ...proxied ? { clientConfig: { requestHandler: buildProxyRequestHandler() } } : {}
417
+ });
418
+ })().catch((err) => {
419
+ chain = void 0;
420
+ throw err;
421
+ });
422
+ return (await chain)(identityProperties);
423
+ };
424
+ }
425
+ function workloadClientConfig(opts = {}) {
426
+ const base = buildProxyClientConfig({ profile: opts.profile });
427
+ const rec = callerRecord();
428
+ if (!rec) return base;
429
+ if (opts.profile || process.env["AWS_PROFILE"]) return base;
430
+ if (rec.caller) {
431
+ const caller = rec.caller;
432
+ const credentials = async () => ({
433
+ accessKeyId: caller.accessKeyId,
434
+ secretAccessKey: caller.secretAccessKey,
435
+ ...caller.sessionToken ? { sessionToken: caller.sessionToken } : {}
436
+ });
437
+ return {
438
+ ...base,
439
+ credentials
440
+ };
441
+ }
442
+ return {
443
+ ...base,
444
+ credentials: callerChainWithoutEnv(base.requestHandler !== void 0)
445
+ };
446
+ }
447
+ function workloadStsClientConfig(args) {
448
+ return {
449
+ ...workloadClientConfig({ profile: args.profile }),
450
+ ...args.region && { region: args.region },
451
+ ...args.profile && { profile: args.profile }
452
+ };
453
+ }
454
+ function applyWorkloadEnvCredentials(env) {
455
+ const rec = callerRecord();
456
+ if (!rec) return "unchanged";
457
+ if (rec.caller) {
458
+ env["AWS_ACCESS_KEY_ID"] = rec.caller.accessKeyId;
459
+ env["AWS_SECRET_ACCESS_KEY"] = rec.caller.secretAccessKey;
460
+ if (rec.caller.sessionToken) env["AWS_SESSION_TOKEN"] = rec.caller.sessionToken;
461
+ else delete env["AWS_SESSION_TOKEN"];
462
+ return "restored";
463
+ }
464
+ delete env["AWS_ACCESS_KEY_ID"];
465
+ delete env["AWS_SECRET_ACCESS_KEY"];
466
+ delete env["AWS_SESSION_TOKEN"];
467
+ return "stripped";
468
+ }
469
+ function warnWorkloadCredentialsStripped() {
470
+ if (stripWarned) return;
471
+ stripWarned = true;
472
+ getLogger().warn("The --role-arn role is not handed to the emulated workload, and your shell had no static AWS credentials to hand it instead, so the container receives none. Pass --profile <name>, or export static credentials, to give it an identity.");
473
+ }
474
+
361
475
  //#endregion
362
476
  //#region src/utils/role-arn.ts
363
477
  const IAM_ROLE_ARN_MAX_LENGTH = 2048;
@@ -391,7 +505,7 @@ async function assumeRoleCredentials(opts) {
391
505
  const message = refusedRoleArnMessage(opts.roleArn);
392
506
  throw opts.makeError ? opts.makeError(message) : new AssumeRoleFailure(message, detail);
393
507
  }
394
- const sts = new STSClient(buildStsClientConfig({
508
+ const sts = new STSClient(workloadStsClientConfig({
395
509
  region: opts.region,
396
510
  profile: opts.profile
397
511
  }));
@@ -425,6 +539,7 @@ async function applyRoleArnIfSet(opts) {
425
539
  const roleArn = opts.roleArn || process.env[`${getEmbedConfig().envPrefix}_ROLE_ARN`];
426
540
  if (!roleArn) return;
427
541
  if (!isIamRoleArn(roleArn)) throw new Error(refusedRoleArnMessage(roleArn));
542
+ if (assumedRoleRecorded() && getEmbedConfig().workloadIdentity === "caller") throw new Error(SECOND_ASSUME_MESSAGE);
428
543
  const logger = getLogger().child("role-arn");
429
544
  const shownArn = flattenToOneLine(roleArn);
430
545
  logger.debug(`Assuming role ${shownArn}...`);
@@ -447,6 +562,7 @@ async function applyRoleArnIfSet(opts) {
447
562
  if (!response.Credentials) throw new Error(`AssumeRole returned no credentials for role ${shownArn}`);
448
563
  const { AccessKeyId, SecretAccessKey, SessionToken, Expiration } = response.Credentials;
449
564
  if (!AccessKeyId || !SecretAccessKey || !SessionToken) throw new Error(`AssumeRole response missing credentials fields for role ${shownArn}`);
565
+ if (!assumedRoleRecorded()) recordAssumedRole(readEnvCallerCredentials());
450
566
  process.env["AWS_ACCESS_KEY_ID"] = AccessKeyId;
451
567
  process.env["AWS_SECRET_ACCESS_KEY"] = SecretAccessKey;
452
568
  process.env["AWS_SESSION_TOKEN"] = SessionToken;
@@ -751,7 +867,7 @@ var DynamicReferenceResolver = class {
751
867
  let c = this.smClients.get(key);
752
868
  if (!c) {
753
869
  c = this.options.secretsManagerClientFactory?.(region) ?? new SecretsManagerClient({
754
- ...buildProxyClientConfig({ profile: this.options.profile }),
870
+ ...workloadClientConfig({ profile: this.options.profile }),
755
871
  ...region && { region },
756
872
  ...this.options.profile && { profile: this.options.profile }
757
873
  });
@@ -764,7 +880,7 @@ var DynamicReferenceResolver = class {
764
880
  let c = this.ssmClients.get(key);
765
881
  if (!c) {
766
882
  c = this.options.ssmClientFactory?.(region) ?? new SSMClient({
767
- ...buildProxyClientConfig({ profile: this.options.profile }),
883
+ ...workloadClientConfig({ profile: this.options.profile }),
768
884
  ...region && { region },
769
885
  ...this.options.profile && { profile: this.options.profile }
770
886
  });
@@ -2082,37 +2198,37 @@ async function getClient(service, region) {
2082
2198
  switch (service) {
2083
2199
  case "sqs":
2084
2200
  client = new (await (import("@aws-sdk/client-sqs"))).SQSClient({
2085
- ...buildProxyClientConfig(),
2201
+ ...workloadClientConfig(),
2086
2202
  region
2087
2203
  });
2088
2204
  break;
2089
2205
  case "sns":
2090
2206
  client = new (await (import("@aws-sdk/client-sns"))).SNSClient({
2091
- ...buildProxyClientConfig(),
2207
+ ...workloadClientConfig(),
2092
2208
  region
2093
2209
  });
2094
2210
  break;
2095
2211
  case "eventbridge":
2096
2212
  client = new (await (import("@aws-sdk/client-eventbridge"))).EventBridgeClient({
2097
- ...buildProxyClientConfig(),
2213
+ ...workloadClientConfig(),
2098
2214
  region
2099
2215
  });
2100
2216
  break;
2101
2217
  case "kinesis":
2102
2218
  client = new (await (import("@aws-sdk/client-kinesis"))).KinesisClient({
2103
- ...buildProxyClientConfig(),
2219
+ ...workloadClientConfig(),
2104
2220
  region
2105
2221
  });
2106
2222
  break;
2107
2223
  case "sfn":
2108
2224
  client = new (await (import("@aws-sdk/client-sfn"))).SFNClient({
2109
- ...buildProxyClientConfig(),
2225
+ ...workloadClientConfig(),
2110
2226
  region
2111
2227
  });
2112
2228
  break;
2113
2229
  case "ssm":
2114
2230
  client = new (await (import("@aws-sdk/client-ssm"))).SSMClient({
2115
- ...buildProxyClientConfig(),
2231
+ ...workloadClientConfig(),
2116
2232
  region
2117
2233
  });
2118
2234
  break;
@@ -3392,7 +3508,7 @@ async function resolveMultiTarget(provided, params) {
3392
3508
  async function loadSynthDeps() {
3393
3509
  const [toolkitLib, { CdklIoHost }, { AssetManifestArtifact }] = await Promise.all([
3394
3510
  import("@aws-cdk/toolkit-lib"),
3395
- import("./cdkl-io-host-9lPKscRA.js"),
3511
+ import("./cdkl-io-host-CDXI-7cC.js"),
3396
3512
  import("@aws-cdk/cloud-assembly-api")
3397
3513
  ]);
3398
3514
  return {
@@ -3672,7 +3788,7 @@ var CfnLocalStateProvider = class {
3672
3788
  getClient() {
3673
3789
  if (this.disposed) throw new Error("CfnLocalStateProvider used after dispose()");
3674
3790
  if (!this.client) this.client = new CloudFormationClient({
3675
- ...buildProxyClientConfig({ profile: this.clientOptions.profile }),
3791
+ ...workloadClientConfig({ profile: this.clientOptions.profile }),
3676
3792
  region: this.region,
3677
3793
  ...this.clientOptions.profile !== void 0 && { profile: this.clientOptions.profile }
3678
3794
  });
@@ -3681,7 +3797,7 @@ var CfnLocalStateProvider = class {
3681
3797
  getLambdaClient() {
3682
3798
  if (this.disposed) throw new Error("CfnLocalStateProvider used after dispose()");
3683
3799
  if (!this.lambdaClient) this.lambdaClient = new LambdaClient({
3684
- ...buildProxyClientConfig({ profile: this.clientOptions.profile }),
3800
+ ...workloadClientConfig({ profile: this.clientOptions.profile }),
3685
3801
  region: this.region,
3686
3802
  ...this.clientOptions.profile !== void 0 && { profile: this.clientOptions.profile }
3687
3803
  });
@@ -3690,7 +3806,7 @@ var CfnLocalStateProvider = class {
3690
3806
  getAgentCoreControlClient() {
3691
3807
  if (this.disposed) throw new Error("CfnLocalStateProvider used after dispose()");
3692
3808
  if (!this.agentCoreControlClient) this.agentCoreControlClient = new BedrockAgentCoreControlClient({
3693
- ...buildProxyClientConfig({ profile: this.clientOptions.profile }),
3809
+ ...workloadClientConfig({ profile: this.clientOptions.profile }),
3694
3810
  region: this.region,
3695
3811
  ...this.clientOptions.profile !== void 0 && { profile: this.clientOptions.profile }
3696
3812
  });
@@ -3699,7 +3815,7 @@ var CfnLocalStateProvider = class {
3699
3815
  getSsmClient() {
3700
3816
  if (this.disposed) throw new Error("CfnLocalStateProvider used after dispose()");
3701
3817
  if (!this.ssmClient) this.ssmClient = new SSMClient({
3702
- ...buildProxyClientConfig({ profile: this.clientOptions.profile }),
3818
+ ...workloadClientConfig({ profile: this.clientOptions.profile }),
3703
3819
  region: this.region,
3704
3820
  ...this.clientOptions.profile !== void 0 && { profile: this.clientOptions.profile }
3705
3821
  });
@@ -5468,6 +5584,166 @@ function resolveRuntimeCodeMountPath(runtime) {
5468
5584
  return "/var/task";
5469
5585
  }
5470
5586
 
5587
+ //#endregion
5588
+ //#region src/utils/docker-argv-redaction.ts
5589
+ const REDACTED_ARGV_VALUE = "***";
5590
+ const ARGV_VALUE_BEARING_FLAGS = /* @__PURE__ */ new Set([
5591
+ "-e",
5592
+ "--env",
5593
+ "--opt",
5594
+ "--label",
5595
+ "--build-arg"
5596
+ ]);
5597
+ const ARGV_PARAM_LIST_FLAGS = /* @__PURE__ */ new Set(["--cache-from", "--cache-to"]);
5598
+ const ARGV_PARAM_LIST_LOCATOR_PARAMS = /* @__PURE__ */ new Set([
5599
+ "type",
5600
+ "mode",
5601
+ "compression",
5602
+ "compression-level",
5603
+ "force-compression",
5604
+ "ignore-error",
5605
+ "image-manifest",
5606
+ "oci-mediatypes",
5607
+ "timeout",
5608
+ "ref",
5609
+ "dest",
5610
+ "src",
5611
+ "digest",
5612
+ "tag",
5613
+ "region",
5614
+ "bucket",
5615
+ "name",
5616
+ "prefix",
5617
+ "manifests_prefix",
5618
+ "blobs_prefix",
5619
+ "use_path_style",
5620
+ "upload_parallelism",
5621
+ "touch_refresh",
5622
+ "account_name",
5623
+ "scope"
5624
+ ]);
5625
+ const ARGV_PARAM_LIST_URL_PARAMS = /* @__PURE__ */ new Set([
5626
+ "account_url",
5627
+ "endpoint_url",
5628
+ "url",
5629
+ "url_v2"
5630
+ ]);
5631
+ function redactUrlLocator(value) {
5632
+ if (value === "") return value;
5633
+ const authority = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\//.exec(value);
5634
+ if (authority === null) return REDACTED_ARGV_VALUE;
5635
+ const prefix = authority[0];
5636
+ let rest = value.slice(prefix.length);
5637
+ const lastAt = rest.lastIndexOf("@");
5638
+ if (lastAt >= 0) rest = `${REDACTED_ARGV_VALUE}${rest.slice(lastAt)}`;
5639
+ else {
5640
+ const host = rest.split(/[/?#]/)[0];
5641
+ const ipv6 = /^\[[0-9A-Fa-f:.]+\]/.exec(host);
5642
+ const bare = ipv6 ? host.slice(ipv6[0].length) : host;
5643
+ if (/:(?!\d{1,5}$)/.test(bare)) return REDACTED_ARGV_VALUE;
5644
+ }
5645
+ for (const delimiter of ["?", "#"]) {
5646
+ const at = rest.indexOf(delimiter);
5647
+ if (at >= 0) rest = `${rest.slice(0, at)}${delimiter}${REDACTED_ARGV_VALUE}`;
5648
+ }
5649
+ return `${prefix}${rest}`;
5650
+ }
5651
+ function maskArgvFlagValue(flag, value) {
5652
+ if (ARGV_VALUE_BEARING_FLAGS.has(flag)) {
5653
+ const eqIdx = value.indexOf("=");
5654
+ return eqIdx >= 0 ? `${value.substring(0, eqIdx)}=${REDACTED_ARGV_VALUE}` : void 0;
5655
+ }
5656
+ if (ARGV_PARAM_LIST_FLAGS.has(flag)) {
5657
+ let masked = false;
5658
+ const rawParts = value.split(",");
5659
+ const parts = rawParts.map((part, index) => {
5660
+ if (part === "") return part;
5661
+ if (masked) return REDACTED_ARGV_VALUE;
5662
+ const eqIdx = part.indexOf("=");
5663
+ if (eqIdx < 0) {
5664
+ if (index === 0) return part;
5665
+ masked = true;
5666
+ return REDACTED_ARGV_VALUE;
5667
+ }
5668
+ const name = part.substring(0, eqIdx);
5669
+ const normalized = name.trim().toLowerCase();
5670
+ if (ARGV_PARAM_LIST_URL_PARAMS.has(normalized)) {
5671
+ if (rawParts.slice(index + 1).some((later) => later.includes("@"))) {
5672
+ masked = true;
5673
+ return `${name}=${REDACTED_ARGV_VALUE}`;
5674
+ }
5675
+ const rawUrl = part.substring(eqIdx + 1);
5676
+ const safeUrl = redactUrlLocator(rawUrl);
5677
+ if (safeUrl === rawUrl) return part;
5678
+ masked = true;
5679
+ return `${name}=${safeUrl}`;
5680
+ }
5681
+ if (ARGV_PARAM_LIST_LOCATOR_PARAMS.has(normalized)) return part;
5682
+ masked = true;
5683
+ return `${name}=${REDACTED_ARGV_VALUE}`;
5684
+ });
5685
+ return masked ? parts.join(",") : void 0;
5686
+ }
5687
+ }
5688
+ function maskAttachedShortFlag(arg) {
5689
+ if (arg.startsWith("--") || !arg.startsWith("-")) return void 0;
5690
+ let chosen;
5691
+ for (const flag of ARGV_VALUE_BEARING_FLAGS) {
5692
+ if (flag.length !== 2 || !flag.startsWith("-") || flag[1] === "-") continue;
5693
+ const at = arg.indexOf(flag[1], 1);
5694
+ if (at < 0 || at === arg.length - 1) continue;
5695
+ if (chosen === void 0 || at < chosen.at) chosen = {
5696
+ at,
5697
+ flag
5698
+ };
5699
+ }
5700
+ if (chosen === void 0) return void 0;
5701
+ const masked = maskArgvFlagValue(chosen.flag, arg.slice(chosen.at + 1));
5702
+ return masked === void 0 ? void 0 : `${arg.slice(0, chosen.at + 1)}${masked}`;
5703
+ }
5704
+ function trailingShortFlagOfCluster(arg) {
5705
+ if (arg.startsWith("--") || !arg.startsWith("-")) return void 0;
5706
+ const last = arg[arg.length - 1];
5707
+ for (const flag of ARGV_VALUE_BEARING_FLAGS) if (flag.length === 2 && flag.startsWith("-") && flag[1] !== "-" && flag[1] === last) return flag;
5708
+ }
5709
+ function redactDockerArgvValues(args) {
5710
+ const out = [];
5711
+ for (let i = 0; i < args.length; i++) {
5712
+ const cur = args[i];
5713
+ const joinedEq = cur.indexOf("=");
5714
+ if (joinedEq > 0) {
5715
+ const maskedJoined = maskArgvFlagValue(cur.substring(0, joinedEq), cur.substring(joinedEq + 1));
5716
+ if (maskedJoined !== void 0) {
5717
+ out.push(`${cur.substring(0, joinedEq)}=${maskedJoined}`);
5718
+ continue;
5719
+ }
5720
+ }
5721
+ const maskedAttached = maskAttachedShortFlag(cur);
5722
+ if (maskedAttached !== void 0) {
5723
+ out.push(maskedAttached);
5724
+ continue;
5725
+ }
5726
+ const next = args[i + 1];
5727
+ if (typeof next === "string") {
5728
+ const maskedNext = maskArgvFlagValue(ARGV_VALUE_BEARING_FLAGS.has(cur) ? cur : trailingShortFlagOfCluster(cur) ?? cur, next);
5729
+ if (maskedNext !== void 0) {
5730
+ out.push(cur, maskedNext);
5731
+ i++;
5732
+ continue;
5733
+ }
5734
+ }
5735
+ out.push(cur);
5736
+ }
5737
+ return out;
5738
+ }
5739
+ function describeExitWithoutArgv(err) {
5740
+ const e = err;
5741
+ if (typeof e?.signal === "string" && e.signal !== "") return `killed by ${e.signal}`;
5742
+ if (typeof e?.code === "number") return `exited with code ${e.code}`;
5743
+ if (typeof e?.code === "string" && e.code !== "") return `failed (${e.code})`;
5744
+ return "failed with no output";
5745
+ }
5746
+
5471
5747
  //#endregion
5472
5748
  //#region src/assets/asset-source-path.ts
5473
5749
  function resolveAssetSourcePath(opts) {
@@ -5744,7 +6020,7 @@ async function buildDockerImage(asset, cdkOutDir, options) {
5744
6020
  const [cmd, ...args] = source.executable;
5745
6021
  if (!cmd) throw options.wrapError("asset source.executable[] is empty");
5746
6022
  const cwd = source.directory ? contextDirectory(source.directory, "run this asset's source.executable with that directory as its working directory") : cdkOutDir;
5747
- logger.debug(`Building Docker image via executable: ${displayUntrustedValue(source.executable.join(" "))} (cwd=${displayUntrustedValue(cwd)})`);
6023
+ logger.debug(`Building Docker image via executable: ${displayUntrustedValue(redactDockerArgvValues(source.executable).join(" "))} (cwd=${displayUntrustedValue(cwd)})`);
5748
6024
  warnManifestExecutable(cmd, source.executable, cwd);
5749
6025
  let result;
5750
6026
  try {
@@ -5757,13 +6033,13 @@ async function buildDockerImage(asset, cdkOutDir, options) {
5757
6033
  if (!tag) throw options.wrapError(`docker build executable produced no output (expected the local image tag on stdout): ${displayUntrustedValue(cmd)}`);
5758
6034
  return tag;
5759
6035
  }
5760
- if (!source.directory) throw options.wrapError(`DockerImageAssetSource must set either 'directory' or 'executable' (got: ${JSON.stringify(source)})`);
6036
+ if (!source.directory) throw options.wrapError(`DockerImageAssetSource must set either 'directory' or 'executable' (fields present: ${displayUntrustedValue(Object.keys(source).join(", ") || "none")})`);
5761
6037
  if (!options.tag) throw options.wrapError("buildDockerImage(directory mode) requires options.tag");
5762
6038
  const buildArgs = buildDockerBuildCommand(source, options.tag, options.platform);
5763
6039
  const contextDir = contextDirectory(source.directory, `send that directory to docker build as the context of an image ${getEmbedConfig().productName} then runs locally`);
5764
6040
  buildArgs.push(".");
5765
6041
  warnEscapingBuildKitPaths(source, contextDir, assetOutdir);
5766
- logger.debug(`${getDockerCmd()} ${buildArgs.join(" ")} (cwd=${displayUntrustedValue(contextDir)})`);
6042
+ logger.debug(`${getDockerCmd()} ${redactDockerArgvValues(buildArgs).join(" ")} (cwd=${displayUntrustedValue(contextDir)})`);
5767
6043
  try {
5768
6044
  await runDockerStreaming(buildArgs, {
5769
6045
  cwd: contextDir,
@@ -5893,7 +6169,7 @@ async function pullEcrImage(imageUri, options) {
5893
6169
  async function assumeRoleForEcr(roleArn, callerRegion, profile, logger) {
5894
6170
  if (!isIamRoleArn(roleArn)) throw new LocalInvokeBuildError(refusedRoleArnMessage(roleArn));
5895
6171
  logger.debug(`Assuming role ${roleArn} for ECR pull...`);
5896
- const sts = new STSClient(buildStsClientConfig({
6172
+ const sts = new STSClient(workloadStsClientConfig({
5897
6173
  region: callerRegion,
5898
6174
  profile
5899
6175
  }));
@@ -6136,7 +6412,7 @@ async function runDetached(opts) {
6136
6412
  }
6137
6413
  args.push(opts.image, ...entryPointTail, ...opts.cmd);
6138
6414
  const logger = getLogger().child("docker");
6139
- logger.debug(`${getDockerCmd()} ${redactAwsCredentialsInArgs(args).join(" ")}`);
6415
+ logger.debug(flattenToOneLine(`${getDockerCmd()} ${redactDockerArgvValues(args).join(" ")}`));
6140
6416
  if (collisions.length > 0) logger.warn(describeRefusedSensitiveEnvKeys(`Container for image ${displayUntrustedValue(opts.image)}`, collisions));
6141
6417
  const forwardedKeys = Object.keys(passthroughEnv);
6142
6418
  const refusal = finchSecretArgvRefusal(forwardedKeys.filter((k) => opts.sensitiveEnvKeys?.has(k)), {
@@ -6152,8 +6428,7 @@ async function runDetached(opts) {
6152
6428
  });
6153
6429
  return stdout.trim();
6154
6430
  } catch (error) {
6155
- const err = error;
6156
- throw new DockerRunnerError(`docker run failed: ${err.stderr?.trim() || err.message || String(error)}`);
6431
+ throw new DockerRunnerError(`docker run failed: ${error.stderr?.trim() || describeExitWithoutArgv(error)}`);
6157
6432
  }
6158
6433
  }
6159
6434
  function streamLogs(containerId) {
@@ -6250,26 +6525,6 @@ function execEnvForSecrets(passthrough) {
6250
6525
  for (const k of keys) defineOwnKey(env, k, passthrough[k]);
6251
6526
  return { env };
6252
6527
  }
6253
- function redactAwsCredentialsInArgs(args) {
6254
- const out = [];
6255
- for (let i = 0; i < args.length; i++) {
6256
- const cur = args[i];
6257
- const next = args[i + 1];
6258
- if (cur === "-e" && typeof next === "string") {
6259
- const eqIdx = next.indexOf("=");
6260
- if (eqIdx > 0) {
6261
- const key = next.substring(0, eqIdx);
6262
- if (SENSITIVE_ENV_KEYS.has(key)) {
6263
- out.push("-e", `${key}=***`);
6264
- i++;
6265
- continue;
6266
- }
6267
- }
6268
- }
6269
- out.push(cur);
6270
- }
6271
- return out;
6272
- }
6273
6528
 
6274
6529
  //#endregion
6275
6530
  //#region src/assets/asset-manifest-loader.ts
@@ -10133,7 +10388,7 @@ function defaultCredentialsLoader() {
10133
10388
  if (cached) return cached;
10134
10389
  cached = (async () => {
10135
10390
  const { STSClient } = await import("@aws-sdk/client-sts");
10136
- const client = new STSClient({ ...buildProxyClientConfig() });
10391
+ const client = new STSClient({ ...workloadClientConfig() });
10137
10392
  const creds = await client.config.credentials();
10138
10393
  client.destroy();
10139
10394
  return {
@@ -11501,7 +11756,7 @@ async function assumeRoleForLayer(roleArn, region, options) {
11501
11756
  async function defaultLambdaClientFactory() {
11502
11757
  const { LambdaClient } = await import("@aws-sdk/client-lambda");
11503
11758
  return (region, credentials) => new LambdaClient({
11504
- ...buildProxyClientConfig(),
11759
+ ...workloadClientConfig(),
11505
11760
  region,
11506
11761
  ...credentials && { credentials: {
11507
11762
  accessKeyId: credentials.accessKeyId,
@@ -11513,7 +11768,7 @@ async function defaultLambdaClientFactory() {
11513
11768
  async function defaultStsClientFactory() {
11514
11769
  const { STSClient } = await import("@aws-sdk/client-sts");
11515
11770
  return (region) => new STSClient({
11516
- ...buildProxyClientConfig(),
11771
+ ...workloadClientConfig(),
11517
11772
  region
11518
11773
  });
11519
11774
  }
@@ -12579,13 +12834,14 @@ async function buildContainerSpec(args) {
12579
12834
  dockerEnv["AWS_SESSION_TOKEN"] = creds.sessionToken;
12580
12835
  if (stsRegion) dockerEnv["AWS_REGION"] = stsRegion;
12581
12836
  } else {
12582
- forwardAwsEnv$3(dockerEnv);
12837
+ const forwarded = forwardAwsEnv$3(dockerEnv);
12583
12838
  if (profileCredentials) {
12584
12839
  dockerEnv["AWS_ACCESS_KEY_ID"] = profileCredentials.accessKeyId;
12585
12840
  dockerEnv["AWS_SECRET_ACCESS_KEY"] = profileCredentials.secretAccessKey;
12586
12841
  if (profileCredentials.sessionToken) dockerEnv["AWS_SESSION_TOKEN"] = profileCredentials.sessionToken;
12587
12842
  else delete dockerEnv["AWS_SESSION_TOKEN"];
12588
12843
  }
12844
+ if (forwarded === "stripped" && !dockerEnv["AWS_ACCESS_KEY_ID"]) warnWorkloadCredentialsStripped();
12589
12845
  if (profileCredsFile) {
12590
12846
  dockerEnv["AWS_SHARED_CREDENTIALS_FILE"] = profileCredsFile.containerPath;
12591
12847
  dockerEnv["AWS_PROFILE"] = profileCredsFile.profileName;
@@ -12872,6 +13128,7 @@ function forwardAwsEnv$3(env) {
12872
13128
  const value = process.env[key];
12873
13129
  if (value !== void 0) env[key] = value;
12874
13130
  }
13131
+ return applyWorkloadEnvCredentials(env);
12875
13132
  }
12876
13133
  function resolveContainerFallbackRegion(args) {
12877
13134
  return args.stackRegionOverride ?? args.synthRegion ?? args.profileRegion;
@@ -13060,7 +13317,7 @@ async function resolvePseudoParametersForStartApi(stateRegion, options) {
13060
13317
  let accountId;
13061
13318
  try {
13062
13319
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
13063
- const sts = new STSClient(buildStsClientConfig({
13320
+ const sts = new STSClient(workloadStsClientConfig({
13064
13321
  region,
13065
13322
  profile: options.profile
13066
13323
  }));
@@ -13445,7 +13702,7 @@ async function resolvePseudoParametersForInvoke(stackRegion, options) {
13445
13702
  let accountId;
13446
13703
  try {
13447
13704
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
13448
- const sts = new STSClient(buildStsClientConfig({
13705
+ const sts = new STSClient(workloadStsClientConfig({
13449
13706
  region,
13450
13707
  profile: options.profile
13451
13708
  }));
@@ -13521,6 +13778,7 @@ function forwardAwsEnv$2(env) {
13521
13778
  const value = process.env[key];
13522
13779
  if (value !== void 0) env[key] = value;
13523
13780
  }
13781
+ return applyWorkloadEnvCredentials(env);
13524
13782
  }
13525
13783
  function applyProfileCredentialsOverlay(env, profileCreds, assumeRoleActive) {
13526
13784
  if (!profileCreds) return;
@@ -13665,8 +13923,9 @@ async function resolveLambdaContainerEnvWith(lambda, options, profileCredentials
13665
13923
  }
13666
13924
  }
13667
13925
  if (!assumeSucceeded) {
13668
- forwardAwsEnv$2(dockerEnv);
13926
+ const forwarded = forwardAwsEnv$2(dockerEnv);
13669
13927
  applyProfileCredentialsOverlay(dockerEnv, profileCredentials, false);
13928
+ if (forwarded === "stripped" && !dockerEnv["AWS_ACCESS_KEY_ID"]) warnWorkloadCredentialsStripped();
13670
13929
  }
13671
13930
  if (!dockerEnv["AWS_REGION"] && !dockerEnv["AWS_DEFAULT_REGION"]) {
13672
13931
  const fallbackRegion = resolveContainerFallbackRegion({
@@ -14891,10 +15150,16 @@ async function resolveHostCredentialsForSigV4(options, resolved, loaded, region,
14891
15150
  ...creds.sessionToken && { sessionToken: creds.sessionToken }
14892
15151
  };
14893
15152
  }
14894
- const accessKeyId = process.env["AWS_ACCESS_KEY_ID"];
14895
- const secretAccessKey = process.env["AWS_SECRET_ACCESS_KEY"];
15153
+ const hostEnv = {
15154
+ AWS_ACCESS_KEY_ID: process.env["AWS_ACCESS_KEY_ID"],
15155
+ AWS_SECRET_ACCESS_KEY: process.env["AWS_SECRET_ACCESS_KEY"],
15156
+ AWS_SESSION_TOKEN: process.env["AWS_SESSION_TOKEN"]
15157
+ };
15158
+ applyWorkloadEnvCredentials(hostEnv);
15159
+ const accessKeyId = hostEnv["AWS_ACCESS_KEY_ID"];
15160
+ const secretAccessKey = hostEnv["AWS_SECRET_ACCESS_KEY"];
14896
15161
  if (accessKeyId && secretAccessKey) {
14897
- const sessionToken = process.env["AWS_SESSION_TOKEN"];
15162
+ const sessionToken = hostEnv["AWS_SESSION_TOKEN"];
14898
15163
  return {
14899
15164
  accessKeyId,
14900
15165
  secretAccessKey,
@@ -15121,7 +15386,7 @@ async function buildAgentCoreImageContext(candidate, stateProvider, options) {
15121
15386
  }
15122
15387
  async function resolveCallerAccountId$2(region, profile) {
15123
15388
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
15124
- const sts = new STSClient(buildStsClientConfig({
15389
+ const sts = new STSClient(workloadStsClientConfig({
15125
15390
  region,
15126
15391
  profile
15127
15392
  }));
@@ -15149,8 +15414,9 @@ async function applyAgentCoreCredentialEnv(dockerEnv, args) {
15149
15414
  }
15150
15415
  }
15151
15416
  if (!assumeSucceeded) {
15152
- forwardAwsEnv$1(dockerEnv);
15417
+ const forwarded = forwardAwsEnv$1(dockerEnv);
15153
15418
  applyProfileCredentialsOverlay(dockerEnv, args.profileCredentials, false);
15419
+ if (forwarded === "stripped" && !dockerEnv["AWS_ACCESS_KEY_ID"]) warnWorkloadCredentialsStripped();
15154
15420
  if (args.profileCredsFile) {
15155
15421
  dockerEnv["AWS_SHARED_CREDENTIALS_FILE"] = args.profileCredsFile.containerPath;
15156
15422
  dockerEnv["AWS_PROFILE"] = args.profileCredsFile.profileName;
@@ -15263,11 +15529,12 @@ function forwardAwsEnv$1(env) {
15263
15529
  const value = process.env[key];
15264
15530
  if (value !== void 0) env[key] = value;
15265
15531
  }
15532
+ return applyWorkloadEnvCredentials(env);
15266
15533
  }
15267
15534
  async function assumeAgentCoreExecutionRole(roleArn, region, profile) {
15268
15535
  if (!isIamRoleArn(roleArn)) throw new AssumeRoleFailure(refusedRoleArnMessage(roleArn), `the role ARN is not well-formed: ${describeRejectedRoleArn(roleArn)}`);
15269
15536
  const { STSClient, AssumeRoleCommand } = await import("@aws-sdk/client-sts");
15270
- const sts = new STSClient(buildStsClientConfig({
15537
+ const sts = new STSClient(workloadStsClientConfig({
15271
15538
  region,
15272
15539
  profile
15273
15540
  }));
@@ -15804,8 +16071,7 @@ async function createNetworkAndSidecar(args) {
15804
16071
  return stdout.trim();
15805
16072
  } catch (err) {
15806
16073
  await destroyNetworkOnly(networkName);
15807
- const e = err;
15808
- throw new DockerRunnerError(`Failed to start metadata-endpoints sidecar: ${e.stderr?.trim() || e.message || String(err)}`);
16074
+ throw new DockerRunnerError(`Failed to start metadata-endpoints sidecar: ${err.stderr?.trim() || describeExitWithoutArgv(err)}`);
15809
16075
  }
15810
16076
  }
15811
16077
  async function createTaskNetwork(options = {}) {
@@ -15871,12 +16137,12 @@ async function resolveEcsSecrets(entries, options = {}) {
15871
16137
  if (entries.length === 0) return [];
15872
16138
  const logger = getLogger().child("ecs-secrets");
15873
16139
  const secretsClient = options.secretsManagerClient ?? new SecretsManagerClient({
15874
- ...buildProxyClientConfig({ profile: options.profile }),
16140
+ ...workloadClientConfig({ profile: options.profile }),
15875
16141
  ...options.region && { region: options.region },
15876
16142
  ...options.profile && { profile: options.profile }
15877
16143
  });
15878
16144
  const ssmClient = options.ssmClient ?? new SSMClient({
15879
- ...buildProxyClientConfig({ profile: options.profile }),
16145
+ ...workloadClientConfig({ profile: options.profile }),
15880
16146
  ...options.region && { region: options.region },
15881
16147
  ...options.profile && { profile: options.profile }
15882
16148
  });
@@ -16160,7 +16426,7 @@ async function runEcsTask(task, options, state) {
16160
16426
  id = stdout.trim();
16161
16427
  } catch (err) {
16162
16428
  const e = err;
16163
- throw new DockerRunnerError(`docker run failed for container '${container.name}': ${e.stderr?.trim() || e.message || String(err)}`);
16429
+ throw new DockerRunnerError(`docker run failed for container '${container.name}': ${e.stderr?.trim() || describeExitWithoutArgv(err)}`);
16164
16430
  }
16165
16431
  state.startedContainers.push({
16166
16432
  name: container.name,
@@ -16378,7 +16644,7 @@ async function realizeDockerVolumes(volumes, state) {
16378
16644
  logger.debug(`Created docker volume ${dockerVolumeName} for task volume '${v.name}'`);
16379
16645
  } catch (err) {
16380
16646
  const e = err;
16381
- throw new DockerRunnerError(`docker volume create failed for '${v.name}': ${e.stderr?.trim() || e.message || String(err)}`);
16647
+ throw new DockerRunnerError(`docker volume create failed for '${v.name}': ${e.stderr?.trim() || describeExitWithoutArgv(err)}`);
16382
16648
  }
16383
16649
  out.set(v.name, {
16384
16650
  ...v,
@@ -17243,7 +17509,7 @@ async function softReloadReplica(args) {
17243
17509
  const defaultDockerInspectWorkdirImpl = async (containerId) => {
17244
17510
  const { execFile } = await import("node:child_process");
17245
17511
  const { promisify } = await import("node:util");
17246
- const { getDockerCmd } = await import("./docker-cmd-GME6jkl9.js").then((n) => n.t);
17512
+ const { getDockerCmd } = await import("./docker-cmd-BSdu45mc.js").then((n) => n.t);
17247
17513
  const { stdout } = await promisify(execFile)(getDockerCmd(), [
17248
17514
  "inspect",
17249
17515
  "--format",
@@ -17256,7 +17522,7 @@ let dockerInspectWorkdirImpl = defaultDockerInspectWorkdirImpl;
17256
17522
  const defaultDockerCpImpl = async (src, dst) => {
17257
17523
  const { execFile } = await import("node:child_process");
17258
17524
  const { promisify } = await import("node:util");
17259
- const { getDockerCmd } = await import("./docker-cmd-GME6jkl9.js").then((n) => n.t);
17525
+ const { getDockerCmd } = await import("./docker-cmd-BSdu45mc.js").then((n) => n.t);
17260
17526
  await promisify(execFile)(getDockerCmd(), [
17261
17527
  "cp",
17262
17528
  src,
@@ -17267,7 +17533,7 @@ let dockerCpImpl = defaultDockerCpImpl;
17267
17533
  const defaultDockerRestartImpl = async (containerId) => {
17268
17534
  const { execFile } = await import("node:child_process");
17269
17535
  const { promisify } = await import("node:util");
17270
- const { getDockerCmd } = await import("./docker-cmd-GME6jkl9.js").then((n) => n.t);
17536
+ const { getDockerCmd } = await import("./docker-cmd-BSdu45mc.js").then((n) => n.t);
17271
17537
  await promisify(execFile)(getDockerCmd(), ["restart", containerId]);
17272
17538
  };
17273
17539
  let dockerRestartImpl = defaultDockerRestartImpl;
@@ -17285,7 +17551,7 @@ async function disconnectOldFromSharedNetwork(oldInstance) {
17285
17551
  const defaultDockerNetworkDisconnectImpl = async (networkName, containerId) => {
17286
17552
  const { execFile } = await import("node:child_process");
17287
17553
  const { promisify } = await import("node:util");
17288
- const { getDockerCmd } = await import("./docker-cmd-GME6jkl9.js").then((n) => n.t);
17554
+ const { getDockerCmd } = await import("./docker-cmd-BSdu45mc.js").then((n) => n.t);
17289
17555
  await promisify(execFile)(getDockerCmd(), [
17290
17556
  "network",
17291
17557
  "disconnect",
@@ -17425,7 +17691,7 @@ function pickEssentialContainerId(instance, service) {
17425
17691
  const defaultWaitForExitImpl = async (containerId) => {
17426
17692
  const { execFile } = await import("node:child_process");
17427
17693
  const { promisify } = await import("node:util");
17428
- const { getDockerCmd } = await import("./docker-cmd-GME6jkl9.js").then((n) => n.t);
17694
+ const { getDockerCmd } = await import("./docker-cmd-BSdu45mc.js").then((n) => n.t);
17429
17695
  const { stdout } = await promisify(execFile)(getDockerCmd(), ["wait", containerId], { maxBuffer: 1024 * 1024 });
17430
17696
  const code = parseInt(stdout.trim(), 10);
17431
17697
  return Number.isFinite(code) ? code : -1;
@@ -17435,7 +17701,7 @@ const EXIT_LOG_TAIL_LINES = 50;
17435
17701
  const defaultReadContainerLogsImpl = async (containerId) => {
17436
17702
  const { execFile } = await import("node:child_process");
17437
17703
  const { promisify } = await import("node:util");
17438
- const { getDockerCmd } = await import("./docker-cmd-GME6jkl9.js").then((n) => n.t);
17704
+ const { getDockerCmd } = await import("./docker-cmd-BSdu45mc.js").then((n) => n.t);
17439
17705
  const { stdout, stderr } = await promisify(execFile)(getDockerCmd(), [
17440
17706
  "logs",
17441
17707
  "--tail",
@@ -18778,6 +19044,7 @@ function forwardAwsEnv() {
18778
19044
  const value = process.env[key];
18779
19045
  if (value !== void 0) env[key] = value;
18780
19046
  }
19047
+ if (applyWorkloadEnvCredentials(env) === "stripped" && !env["AWS_ACCESS_KEY_ID"]) warnWorkloadCredentialsStripped();
18781
19048
  return env;
18782
19049
  }
18783
19050
  function materializeInlineCode(handler, source, fileExtension) {
@@ -20225,7 +20492,7 @@ function describeForwardTargetForSummary(t) {
20225
20492
  async function resolvePlaceholderAccount$1(arn, region, profile) {
20226
20493
  if (!arn.includes("${AWS::AccountId}")) return arn;
20227
20494
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
20228
- const sts = new STSClient(buildStsClientConfig({
20495
+ const sts = new STSClient(workloadStsClientConfig({
20229
20496
  region,
20230
20497
  profile
20231
20498
  }));
@@ -20306,7 +20573,7 @@ function pickCandidateStack$1(stackPattern, stacks) {
20306
20573
  }
20307
20574
  async function resolveCallerAccountId$1(region, profile) {
20308
20575
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
20309
- const sts = new STSClient(buildStsClientConfig({
20576
+ const sts = new STSClient(workloadStsClientConfig({
20310
20577
  region,
20311
20578
  profile
20312
20579
  }));
@@ -20651,7 +20918,7 @@ var PlaceholderAccountError = class PlaceholderAccountError extends Error {
20651
20918
  async function resolvePlaceholderAccount(arn, region, profile) {
20652
20919
  if (!arn.includes("${AWS::AccountId}")) return arn;
20653
20920
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
20654
- const sts = new STSClient(buildStsClientConfig({
20921
+ const sts = new STSClient(workloadStsClientConfig({
20655
20922
  region,
20656
20923
  profile
20657
20924
  }));
@@ -20729,7 +20996,7 @@ function pickCandidateStack(stackPattern, stacks) {
20729
20996
  }
20730
20997
  async function resolveCallerAccountId(region, profile) {
20731
20998
  const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
20732
- const sts = new STSClient(buildStsClientConfig({
20999
+ const sts = new STSClient(workloadStsClientConfig({
20733
21000
  region,
20734
21001
  profile
20735
21002
  }));
@@ -22992,7 +23259,7 @@ function defaultFetchObject(bucketName, options) {
22992
23259
  const { S3Client, GetObjectCommand } = await import("@aws-sdk/client-s3");
22993
23260
  return {
22994
23261
  client: new S3Client({
22995
- ...buildProxyClientConfig(),
23262
+ ...workloadClientConfig(),
22996
23263
  ...options.region && { region: options.region },
22997
23264
  ...options.credentials && { credentials: {
22998
23265
  accessKeyId: options.credentials.accessKeyId,
@@ -23059,7 +23326,7 @@ async function resolveDeployedOriginBucket(options) {
23059
23326
  async function defaultGetOrigins(options) {
23060
23327
  const { CloudFrontClient, GetDistributionConfigCommand } = await import("@aws-sdk/client-cloudfront");
23061
23328
  const client = new CloudFrontClient({
23062
- ...buildProxyClientConfig(),
23329
+ ...workloadClientConfig(),
23063
23330
  region: "us-east-1",
23064
23331
  ...options.credentials && { credentials: {
23065
23332
  accessKeyId: options.credentials.accessKeyId,
@@ -23078,7 +23345,7 @@ async function defaultGetOrigins(options) {
23078
23345
  //#region src/local/cloudfront-kvs-client.ts
23079
23346
  function createDeployedKvsDataSource(options) {
23080
23347
  const client = new CloudFrontKeyValueStoreClient({
23081
- ...buildProxyClientConfig(),
23348
+ ...workloadClientConfig(),
23082
23349
  region: options.region ?? "us-east-1",
23083
23350
  ...options.credentials !== void 0 && { credentials: options.credentials }
23084
23351
  });
@@ -23100,7 +23367,7 @@ function createDeployedKvsDataSource(options) {
23100
23367
  }
23101
23368
  async function resolveDeployedKvsArnByName(name, options = {}) {
23102
23369
  const client = new CloudFrontClient({
23103
- ...buildProxyClientConfig(),
23370
+ ...workloadClientConfig(),
23104
23371
  region: options.region ?? "us-east-1",
23105
23372
  ...options.credentials !== void 0 && { credentials: options.credentials }
23106
23373
  });
@@ -23390,10 +23657,10 @@ function buildLambdaBootOptions(options, profileCredentials, extraStateProviders
23390
23657
  ...extraStateProviders !== void 0 && { extraStateProviders }
23391
23658
  };
23392
23659
  }
23393
- function warnUnsupported(distribution) {
23660
+ function warnUnsupported(distribution, extraStateProviders) {
23394
23661
  const logger = getLogger();
23395
23662
  for (const origin of distribution.origins.values()) if (origin.kind === "custom") logger.warn(`Origin '${origin.originId}' is a custom (non-S3, non-Lambda-Function-URL) origin (${origin.domainName}); ${getEmbedConfig().cliName} start-cloudfront serves S3 origins and Lambda Function URL origins only. Requests routed to it return 502.`);
23396
- else if (origin.kind === "s3-unresolved") logger.warn(`Origin '${origin.originId}' is an S3 origin with no resolvable local source (no BucketDeployment found, or its source could not be located in the cloud assembly). Pass --from-cfn-stack to serve the deployed bucket from real S3 on demand, or point it at a local directory with --origin ${origin.originId}=<dir>. Requests routed to it return 502.`);
23663
+ else if (origin.kind === "s3-unresolved") logger.warn(`Origin '${origin.originId}' is an S3 origin with no resolvable local source (no BucketDeployment found, or its source could not be located in the cloud assembly). Pass ${stateSourceFlagNames(extraStateProviders).join(" or ")} to serve the deployed bucket from real S3 on demand, or point it at a local directory with --origin ${origin.originId}=<dir>. Requests routed to it return 502.`);
23397
23664
  }
23398
23665
  function warnUnusedCacheOrigin(options, extraStateProviders) {
23399
23666
  if (options.cacheOrigin === true && !isStateSourceActive(options, extraStateProviders)) {
@@ -23512,7 +23779,7 @@ async function localStartCloudFrontCommand(target, options, extraStateProviders,
23512
23779
  const initial = await synthAndResolve();
23513
23780
  const profileCredentials = options.profile ? await resolveProfileCredentials(options.profile) : void 0;
23514
23781
  const deployedS3 = await resolveDeployedS3Origins(initial.distribution, initial.stacks, options, profileCredentials, logger, extraStateProviders);
23515
- warnUnsupported(initial.distribution);
23782
+ warnUnsupported(initial.distribution, extraStateProviders);
23516
23783
  warnUnusedCacheOrigin(options, extraStateProviders);
23517
23784
  await attachKvsModules(initial.distribution, initial.stacks, options, profileCredentials, logger, extraStateProviders);
23518
23785
  const bootOpts = buildLambdaBootOptions(options, profileCredentials, extraStateProviders);
@@ -23560,7 +23827,7 @@ async function localStartCloudFrontCommand(target, options, extraStateProviders,
23560
23827
  const reloaded = await synthAndResolve();
23561
23828
  annotateDeployedS3Origins(reloaded.distribution, deployedS3.buckets);
23562
23829
  for (const reader of deployedS3.readers.values()) reader.clearCache();
23563
- warnUnsupported(reloaded.distribution);
23830
+ warnUnsupported(reloaded.distribution, extraStateProviders);
23564
23831
  await attachKvsModules(reloaded.distribution, reloaded.stacks, options, profileCredentials, logger, extraStateProviders);
23565
23832
  server.update(reloaded.distribution);
23566
23833
  logger.info("Reload complete.");
@@ -29569,5 +29836,5 @@ function addStudioSpecificOptions(cmd) {
29569
29836
  }
29570
29837
 
29571
29838
  //#endregion
29572
- export { applyEdgeResponseResult as $, buildJwksUrlFromIssuer as $n, resolveCfnStackName as $r, buildCloudMapIndex as $t, startAgentCoreHttpServer as A, DynamicReferenceResolver as Ai, classifySourceChange as An, ConnectionRegistry as Ar, addRunTaskSpecificOptions as At, idFromArn as B, resolveProfileCredentials as Bi, buildStageMap as Bn, resolveRuntimeFileExtension as Br, resolveEcsAssumeRoleOption as Bt, addListSpecificOptions as C, resolveAgentCoreTarget as Ci, waitForAgentCorePing as Cn, tryParseStatus as Cr, parseLbPortOverrides as Ct, createLocalStartAgentCoreCommand as D, tryResolveImageFnJoin as Di, computeCodeImageTag as Dn, probeHostGatewaySupport as Dr, addStartServiceSpecificOptions as Dt, addStartAgentCoreSpecificOptions as E, substituteImagePlaceholders as Ei, buildAgentCoreCodeImage as En, HOST_GATEWAY_MIN_VERSION as Er, resolveAlbFrontDoor as Et, createLocalStartCloudFrontCommand as F, keysOverriddenBy as Fi, createWatchPredicates as Fn, buildDisconnectEvent as Fr, addImageOverrideOptions as Ft, classifyS3Error as G, filterRoutesByApiIdentifiers as Gn, substituteEnvVarsFromState as Gr, enforceImageOverrideOrphans as Gt, createDeployedKvsDataSource as H, isProxyEnvConfigured as Hi, resolveEnvVars$1 as Hn, EcsTaskResolutionError as Hr, runEcsServiceEmulator as Ht, normalizeKvsFileKeys as I, parseDynamicReference as Ii, resolveApiTargetSubset as In, buildMessageEvent as Ir, buildEcsImageResolutionContext$1 as It, startCloudFrontServer as J, startApiServer as Jn, createLocalStateProvider as Jr, resolveImageOverrides as Jt, createS3OriginReader as K, groupRoutesByServer as Kn, substituteEnvVarsFromStateAsync as Kr, mergeForService as Kt, parseKvsFileOverrides as L, resolveDynamicReferencesInEnv as Li, createAuthorizerCache as Ln, architectureToPlatform as Lr, ecsClusterOption as Lt, startAgentCoreWsBridge as M, deployedFillMayBeSecret as Mi, createLocalInvokeCommand as Mn, handleConnectionsRequest as Mr, MAX_TASKS_SUBNET_RANGE_CAP as Mt, LocalStartCloudFrontError as N, firstUsableRegion as Ni, addStartApiSpecificOptions as Nn, parseConnectionsPath as Nr, addCommonEcsServiceOptions as Nt, buildAgentCoreServeAuthCheck as O, LocalInvokeBuildError as Oi, renderCodeDockerfile as On, resolveHostGatewayExtraHosts as Or, createLocalStartServiceCommand as Ot, addStartCloudFrontSpecificOptions as P, keysNotFromTemplate as Pi, createLocalStartApiCommand as Pn, buildConnectEvent as Pr, addEcsAssumeRoleOptions as Pt, applyEdgeRequestResult as Q, buildCognitoJwksUrl as Qn, resolveCfnRegion as Qr, listPinnedTargets as Qt, parseOriginOverrides as R, withoutKeys as Ri, createFileWatcher as Rn, buildContainerImage as Rr, parseMaxTasks as Rt, StudioEventBus as S, pickAgentCoreCandidateStack as Si, waitForAgentCoreHttpReady as Sn, selectIntegrationResponse as Sr, createLocalStartAlbCommand as St, formatTargetListing as T, formatStateRemedy as Ti, SUPPORTED_CODE_RUNTIMES as Tn, HOST_DOCKER_INTERNAL_GATEWAY as Tr, isApplicationLoadBalancer as Tt, resolveDeployedKvsArnByName as U, availableApiIdentifiers as Un, substituteAgainstState as Ur, ImageOverrideError as Ut, resolveKvsModulesForDistribution as V, buildProxyClientConfig as Vi, materializeLayerFromArn as Vn, resolveRuntimeImage as Vr, resolveSharedSidecarCredentials as Vt, resolveDeployedOriginBucket as W, filterRoutesByApiIdentifier as Wn, substituteAgainstStateAsync as Wr, buildImageOverrideTag as Wt, serveFromStaticOrigin as X, resolveServiceIntegrationParameters as Xn, rejectExplicitCfnStackWithMultipleStacks as Xr, describePinnedImageUri as Xt, resolveErrorResponseCandidates as Y, resolveSelectionExpression as Yn, isCfnFlagPresent as Yr, runImageOverrideBuilds as Yt, serveLambdaUrlOrigin as Z, defaultCredentialsLoader as Zn, resolveCfnFallbackRegion as Zr, isLocalCdkAssetImage as Zt, filterStudioTargetGroups as _, AGENTCORE_AGUI_PROTOCOL as _i, parseSseForJsonRpc as _n, applyAuthorizerOverlay as _r, createCloudFrontModule as _t, createLocalStudioCommand as a, countTargets as ai, attachContainerLogStreamer as an, computeRequestIdentityHash as ar, describeS3OriginDomain as at, renderStudioHtml as b, AGENTCORE_RUNTIME_TYPE as bi, AGENTCORE_SESSION_ID_HEADER as bn, evaluateResponseParameters as br, addAlbSpecificOptions as bt, startStudioProxy as c, discoverWebSocketApis as ci, bridgeAgentCoreWs as cn, invokeTokenAuthorizer as cr, pickFunctionUrlLogicalIdFromOrigin as ct, createStudioDispatcher as d, parseSelectionExpressionPath as di, A2A_PATH as dn, buildCorsConfigByApiId as dr, pickTargetFunctionLogicalId as dt, CfnLocalStateProvider as ei, CloudMapRegistry as en, createJwksCache as er, buildEdgeRequestEvent as et, filterStudioCustomResources as f, webSocketApiMatchesIdentifier as fi, a2aInvokeOnce as fn, buildCorsConfigFromCloudFrontChain as fr, resolveCloudFrontDistribution as ft, annotatePinnedEcsTargets as g, AGENTCORE_A2A_PROTOCOL as gi, mcpInvokeOnce as gn, translateLambdaResponse as gr, stripCloudFrontImport as gt, annotateEcsTaskPinnedTargets as h, resolveLambdaArnIntrinsic as hi, MCP_PROTOCOL_VERSION as hn, matchRoute as hr, runViewerResponse as ht, coerceStopRequest as i, resolveSingleTarget as ii, getContainerNetworkIp as in, buildMethodArn as ir, CLOUDFRONT_DISTRIBUTION_TYPE as it, attachAgentCoreWsBridge as j, containsDynamicReference as ji, addInvokeSpecificOptions as jn, buildMgmtEndpointEnvUrl as jr, createLocalRunTaskCommand as jt, selectServeInboundAuth as k, DynamicReferenceResolutionError as ki, toCmdArgv as kn, bufferToBody as kr, serviceStrategy as kt, relayServeRequest as l, discoverWebSocketApisOrThrow as li, invokeAgentCoreWs as ln, attachAuthorizers as lr, pickKvsLogicalIdFromArn as lt, annotateAlbPinnedBackingServices as m, pickRefLogicalId as mi, MCP_PATH as mn, matchPreflight as mr, runViewerRequest as mt, coerceRunRequest as n, resolveSsmParameters as ni, SOFT_RELOAD_COMPLETION_LOG_SUFFIX as nn, verifyJwtAuthorizer as nr, edgeHeadersToHttp as nt, resolveServeBaseUrl as o, listTargets as oi, addInvokeAgentCoreSpecificOptions as on, evaluateCachedLambdaPolicy as or, extractKvsAssociations as ot, isCustomResourceLambdaTarget as p, discoverRoutes as pi, MCP_CONTAINER_PORT as pn, isFunctionUrlOacFronted as pr, compileCloudFrontFunction as pt, matchBehavior as q, readMtlsMaterialsFromDisk as qn, LocalStateSourceError as qr, parseImageOverrideFlags as qt, coerceServeRequest as r, resolveWatchConfig as ri, setShadowReadyTimeoutMs as rn, verifyJwtViaDiscovery as rr, httpHeadersToEdge as rt, createStudioServeManager as s, availableWebSocketApiIdentifiers as si, createLocalInvokeAgentCoreCommand as sn, invokeRequestAuthorizer as sr, isCloudFrontDistribution as st, addStudioSpecificOptions as t, collectSsmParameterRefs as ti, DEFAULT_SHADOW_READY_TIMEOUT_MS as tn, verifyCognitoJwt as tr, buildEdgeResponseEvent as tt, reinvoke as u, filterWebSocketApisByIdentifiers as ui, A2A_CONTAINER_PORT as un, applyCorsResponseHeaders as ur, pickLambdaEdgeFunctionLogicalId as ut, startStudioServer as v, AGENTCORE_HTTP_PROTOCOL as vi, AGENTCORE_SIGV4_SERVICE as vn, buildHttpApiV2Event as vr, createLocalFileKvsDataSource as vt, createLocalListCommand as w, derivePseudoParametersFromRegion as wi, downloadAndExtractS3Bundle as wn, VtlEvaluationError as wr, resolveAlbTarget as wt, createStudioStore as x, AgentCoreResolutionError as xi, invokeAgentCore as xn, pickResponseTemplate as xr, albStrategy as xt, toStudioTargetGroups as y, AGENTCORE_MCP_PROTOCOL as yi, signAgentCoreInvocation as yn, buildRestV1Event as yr, createUnboundCloudFrontModule as yt, resolveCloudFrontTarget as z, buildStsClientConfig as zi, attachStageContext as zn, resolveRuntimeCodeMountPath as zr, parseRestartPolicy as zt };
29573
- //# sourceMappingURL=local-studio-Mta0QWLf.js.map
29839
+ export { applyEdgeResponseResult as $, buildJwksUrlFromIssuer as $n, resolveCfnStackName as $r, buildCloudMapIndex as $t, startAgentCoreHttpServer as A, DynamicReferenceResolver as Ai, classifySourceChange as An, ConnectionRegistry as Ar, addRunTaskSpecificOptions as At, idFromArn as B, assumedRoleRecorded as Bi, buildStageMap as Bn, resolveRuntimeFileExtension as Br, resolveEcsAssumeRoleOption as Bt, addListSpecificOptions as C, resolveAgentCoreTarget as Ci, waitForAgentCorePing as Cn, tryParseStatus as Cr, parseLbPortOverrides as Ct, createLocalStartAgentCoreCommand as D, tryResolveImageFnJoin as Di, computeCodeImageTag as Dn, probeHostGatewaySupport as Dr, addStartServiceSpecificOptions as Dt, addStartAgentCoreSpecificOptions as E, substituteImagePlaceholders as Ei, buildAgentCoreCodeImage as En, HOST_GATEWAY_MIN_VERSION as Er, resolveAlbFrontDoor as Et, createLocalStartCloudFrontCommand as F, keysOverriddenBy as Fi, createWatchPredicates as Fn, buildDisconnectEvent as Fr, addImageOverrideOptions as Ft, classifyS3Error as G, workloadStsClientConfig as Gi, filterRoutesByApiIdentifiers as Gn, substituteEnvVarsFromState as Gr, enforceImageOverrideOrphans as Gt, createDeployedKvsDataSource as H, recordAssumedRole as Hi, resolveEnvVars$1 as Hn, EcsTaskResolutionError as Hr, runEcsServiceEmulator as Ht, normalizeKvsFileKeys as I, parseDynamicReference as Ii, resolveApiTargetSubset as In, buildMessageEvent as Ir, buildEcsImageResolutionContext$1 as It, startCloudFrontServer as J, buildProxyClientConfig as Ji, startApiServer as Jn, createLocalStateProvider as Jr, resolveImageOverrides as Jt, createS3OriginReader as K, buildStsClientConfig as Ki, groupRoutesByServer as Kn, substituteEnvVarsFromStateAsync as Kr, mergeForService as Kt, parseKvsFileOverrides as L, resolveDynamicReferencesInEnv as Li, createAuthorizerCache as Ln, architectureToPlatform as Lr, ecsClusterOption as Lt, startAgentCoreWsBridge as M, deployedFillMayBeSecret as Mi, createLocalInvokeCommand as Mn, handleConnectionsRequest as Mr, MAX_TASKS_SUBNET_RANGE_CAP as Mt, LocalStartCloudFrontError as N, firstUsableRegion as Ni, addStartApiSpecificOptions as Nn, parseConnectionsPath as Nr, addCommonEcsServiceOptions as Nt, buildAgentCoreServeAuthCheck as O, LocalInvokeBuildError as Oi, renderCodeDockerfile as On, resolveHostGatewayExtraHosts as Or, createLocalStartServiceCommand as Ot, addStartCloudFrontSpecificOptions as P, keysNotFromTemplate as Pi, createLocalStartApiCommand as Pn, buildConnectEvent as Pr, addEcsAssumeRoleOptions as Pt, applyEdgeRequestResult as Q, buildCognitoJwksUrl as Qn, resolveCfnRegion as Qr, listPinnedTargets as Qt, parseOriginOverrides as R, withoutKeys as Ri, createFileWatcher as Rn, buildContainerImage as Rr, parseMaxTasks as Rt, StudioEventBus as S, pickAgentCoreCandidateStack as Si, waitForAgentCoreHttpReady as Sn, selectIntegrationResponse as Sr, createLocalStartAlbCommand as St, formatTargetListing as T, formatStateRemedy as Ti, SUPPORTED_CODE_RUNTIMES as Tn, HOST_DOCKER_INTERNAL_GATEWAY as Tr, isApplicationLoadBalancer as Tt, resolveDeployedKvsArnByName as U, resetWorkloadIdentity as Ui, availableApiIdentifiers as Un, substituteAgainstState as Ur, ImageOverrideError as Ut, resolveKvsModulesForDistribution as V, readEnvCallerCredentials as Vi, materializeLayerFromArn as Vn, resolveRuntimeImage as Vr, resolveSharedSidecarCredentials as Vt, resolveDeployedOriginBucket as W, workloadClientConfig as Wi, filterRoutesByApiIdentifier as Wn, substituteAgainstStateAsync as Wr, buildImageOverrideTag as Wt, serveFromStaticOrigin as X, resolveServiceIntegrationParameters as Xn, rejectExplicitCfnStackWithMultipleStacks as Xr, describePinnedImageUri as Xt, resolveErrorResponseCandidates as Y, isProxyEnvConfigured as Yi, resolveSelectionExpression as Yn, isCfnFlagPresent as Yr, runImageOverrideBuilds as Yt, serveLambdaUrlOrigin as Z, defaultCredentialsLoader as Zn, resolveCfnFallbackRegion as Zr, isLocalCdkAssetImage as Zt, filterStudioTargetGroups as _, AGENTCORE_AGUI_PROTOCOL as _i, parseSseForJsonRpc as _n, applyAuthorizerOverlay as _r, createCloudFrontModule as _t, createLocalStudioCommand as a, countTargets as ai, attachContainerLogStreamer as an, computeRequestIdentityHash as ar, describeS3OriginDomain as at, renderStudioHtml as b, AGENTCORE_RUNTIME_TYPE as bi, AGENTCORE_SESSION_ID_HEADER as bn, evaluateResponseParameters as br, addAlbSpecificOptions as bt, startStudioProxy as c, discoverWebSocketApis as ci, bridgeAgentCoreWs as cn, invokeTokenAuthorizer as cr, pickFunctionUrlLogicalIdFromOrigin as ct, createStudioDispatcher as d, parseSelectionExpressionPath as di, A2A_PATH as dn, buildCorsConfigByApiId as dr, pickTargetFunctionLogicalId as dt, CfnLocalStateProvider as ei, CloudMapRegistry as en, createJwksCache as er, buildEdgeRequestEvent as et, filterStudioCustomResources as f, webSocketApiMatchesIdentifier as fi, a2aInvokeOnce as fn, buildCorsConfigFromCloudFrontChain as fr, resolveCloudFrontDistribution as ft, annotatePinnedEcsTargets as g, AGENTCORE_A2A_PROTOCOL as gi, mcpInvokeOnce as gn, translateLambdaResponse as gr, stripCloudFrontImport as gt, annotateEcsTaskPinnedTargets as h, resolveLambdaArnIntrinsic as hi, MCP_PROTOCOL_VERSION as hn, matchRoute as hr, runViewerResponse as ht, coerceStopRequest as i, resolveSingleTarget as ii, getContainerNetworkIp as in, buildMethodArn as ir, CLOUDFRONT_DISTRIBUTION_TYPE as it, attachAgentCoreWsBridge as j, containsDynamicReference as ji, addInvokeSpecificOptions as jn, buildMgmtEndpointEnvUrl as jr, createLocalRunTaskCommand as jt, selectServeInboundAuth as k, DynamicReferenceResolutionError as ki, toCmdArgv as kn, bufferToBody as kr, serviceStrategy as kt, relayServeRequest as l, discoverWebSocketApisOrThrow as li, invokeAgentCoreWs as ln, attachAuthorizers as lr, pickKvsLogicalIdFromArn as lt, annotateAlbPinnedBackingServices as m, pickRefLogicalId as mi, MCP_PATH as mn, matchPreflight as mr, runViewerRequest as mt, coerceRunRequest as n, resolveSsmParameters as ni, SOFT_RELOAD_COMPLETION_LOG_SUFFIX as nn, verifyJwtAuthorizer as nr, edgeHeadersToHttp as nt, resolveServeBaseUrl as o, listTargets as oi, addInvokeAgentCoreSpecificOptions as on, evaluateCachedLambdaPolicy as or, extractKvsAssociations as ot, isCustomResourceLambdaTarget as p, discoverRoutes as pi, MCP_CONTAINER_PORT as pn, isFunctionUrlOacFronted as pr, compileCloudFrontFunction as pt, matchBehavior as q, resolveProfileCredentials as qi, readMtlsMaterialsFromDisk as qn, LocalStateSourceError as qr, parseImageOverrideFlags as qt, coerceServeRequest as r, resolveWatchConfig as ri, setShadowReadyTimeoutMs as rn, verifyJwtViaDiscovery as rr, httpHeadersToEdge as rt, createStudioServeManager as s, availableWebSocketApiIdentifiers as si, createLocalInvokeAgentCoreCommand as sn, invokeRequestAuthorizer as sr, isCloudFrontDistribution as st, addStudioSpecificOptions as t, collectSsmParameterRefs as ti, DEFAULT_SHADOW_READY_TIMEOUT_MS as tn, verifyCognitoJwt as tr, buildEdgeResponseEvent as tt, reinvoke as u, filterWebSocketApisByIdentifiers as ui, A2A_CONTAINER_PORT as un, applyCorsResponseHeaders as ur, pickLambdaEdgeFunctionLogicalId as ut, startStudioServer as v, AGENTCORE_HTTP_PROTOCOL as vi, AGENTCORE_SIGV4_SERVICE as vn, buildHttpApiV2Event as vr, createLocalFileKvsDataSource as vt, createLocalListCommand as w, derivePseudoParametersFromRegion as wi, downloadAndExtractS3Bundle as wn, VtlEvaluationError as wr, resolveAlbTarget as wt, createStudioStore as x, AgentCoreResolutionError as xi, invokeAgentCore as xn, pickResponseTemplate as xr, albStrategy as xt, toStudioTargetGroups as y, AGENTCORE_MCP_PROTOCOL as yi, signAgentCoreInvocation as yn, buildRestV1Event as yr, createUnboundCloudFrontModule as yt, resolveCloudFrontTarget as z, SECOND_ASSUME_MESSAGE as zi, attachStageContext as zn, resolveRuntimeCodeMountPath as zr, parseRestartPolicy as zt };
29840
+ //# sourceMappingURL=local-studio-DPQ50Gve.js.map