@go-to-k/cdkd 0.284.37 → 0.284.39

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.
@@ -7553,6 +7553,44 @@ function isNoSuchKey(error) {
7553
7553
  return error?.name === "NoSuchKey";
7554
7554
  }
7555
7555
 
7556
+ //#endregion
7557
+ //#region src/utils/display-safe.ts
7558
+ /**
7559
+ * Make an untrusted value safe to render in a terminal or persist into a log.
7560
+ *
7561
+ * A LEAF module with no imports, and deliberately in `src/utils/` rather than
7562
+ * beside its first caller: issue [#2170](https://github.com/go-to-k/cdkd/issues/2170)'s
7563
+ * review found the same rule being widened BY HAND one module at a time and
7564
+ * missing an instance every round — the change sanitized 1 of 5 readers of
7565
+ * `LockInfo.owner`. One shared definition, imported by everything that renders
7566
+ * such a value, is what stops the next reader from inheriting nothing.
7567
+ *
7568
+ * The stripped class is wider than C0 + DEL, which a first cut used and which
7569
+ * misses every mechanism that actually forges a line:
7570
+ *
7571
+ * - `U+0085` (NEL) and the C1 range — xterm reads `U+009B` as CSI in UTF-8;
7572
+ * - `U+2028` / `U+2029` — this text is PERSISTED and re-rendered by JSON and
7573
+ * web log viewers, where both are line terminators;
7574
+ * - `U+202A`-`U+202E` / `U+2066`-`U+2069` — the Trojan-Source bidi overrides
7575
+ * and isolates, which visually REORDER the command being pasted.
7576
+ *
7577
+ * Known residual, recorded rather than implied away: the invisible formatters
7578
+ * (`U+200B`-`U+200D`, `U+FEFF`) and the bidi MARKS (`U+200E` / `U+200F` /
7579
+ * `U+061C`) survive, as do bare RTL letters, which no denylist can reach. All
7580
+ * of them can only make a rendered name differ visually from its bytes — the
7581
+ * command a user pastes still acts on exactly what is shown, and the blast
7582
+ * radius stays the attacker's own stack name.
7583
+ *
7584
+ * A caller whose value has a KNOWN ASCII charset (a stack name, an AWS region)
7585
+ * should pass `asciiOnly`, which is a positive allowlist and therefore has no
7586
+ * such residual at all.
7587
+ */
7588
+ function displaySafe(value, opts) {
7589
+ if (value === void 0 || value === null) return "";
7590
+ const text = String(value);
7591
+ return (opts?.asciiOnly ? text.replace(/[^ -~]/g, " ") : text.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g, " ")).trim();
7592
+ }
7593
+
7556
7594
  //#endregion
7557
7595
  //#region src/state/lock-manager.ts
7558
7596
  /**
@@ -7762,7 +7800,17 @@ var LockManager = class {
7762
7800
  }));
7763
7801
  if (!response.Body) throw new LockError(`Lock file for stack '${stackName}' has no body`);
7764
7802
  const bodyString = await response.Body.transformToString();
7765
- const lockInfo = JSON.parse(bodyString);
7803
+ const raw = JSON.parse(bodyString);
7804
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
7805
+ this.logger.debug(`Lock file for stack ${stackName} is not an object; treating as absent`);
7806
+ return null;
7807
+ }
7808
+ const parsed = raw;
7809
+ const lockInfo = {
7810
+ ...parsed,
7811
+ owner: displaySafe(parsed.owner),
7812
+ ...parsed.operation !== void 0 && { operation: displaySafe(parsed.operation) }
7813
+ };
7766
7814
  this.logger.debug(`Lock info for stack: ${stackName}:`, lockInfo);
7767
7815
  return lockInfo;
7768
7816
  } catch (error) {
@@ -7813,12 +7861,9 @@ var LockManager = class {
7813
7861
  * `{prefix}/{stackName}/lock.json` file.
7814
7862
  */
7815
7863
  async forceReleaseLock(stackName, region) {
7816
- const lockInfo = await this.getLockInfo(stackName, region);
7817
- if (!lockInfo) {
7818
- this.logger.warn(`No lock to force release for stack: ${stackName}${region ? ` (${region})` : ""}`);
7819
- return;
7820
- }
7821
- this.logger.warn(`Force releasing lock for stack: ${stackName}${region ? ` (${region})` : ""}, owner: ${lockInfo.owner}${lockInfo.operation ? `, operation: ${lockInfo.operation}` : ""}, expired: ${this.isLockExpired(lockInfo)}`);
7864
+ const where = `${stackName}${region ? ` (${region})` : ""}`;
7865
+ const lockInfo = await this.getLockInfo(stackName, region).catch(() => null);
7866
+ this.logger.warn(lockInfo ? `Force releasing lock for stack: ${where}, owner: ${lockInfo.owner}${lockInfo.operation ? `, operation: ${lockInfo.operation}` : ""}, expired: ${this.isLockExpired(lockInfo)}` : `Force releasing lock for stack: ${where} (no lock body read — absent or unparseable; deleting the object either way, since a lock cdkd cannot read is a lock nothing else can clear)`);
7822
7867
  await this.deleteLock(stackName, region);
7823
7868
  }
7824
7869
  /**
@@ -17564,7 +17609,7 @@ var CloudControlProvider = class {
17564
17609
  if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
17565
17610
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
17566
17611
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
17567
- const { ASGProvider } = await import("./asg-provider-BbWubpjP.js").then((n) => n.n);
17612
+ const { ASGProvider } = await import("./asg-provider-Db6lnsaA.js").then((n) => n.n);
17568
17613
  return await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
17569
17614
  }
17570
17615
  const isProtectedEc2Instance = context?.removeProtection === true && resourceType === "AWS::EC2::Instance";
@@ -26260,7 +26305,7 @@ const FLUSH_INTERVAL_MS = 2e3;
26260
26305
  const FLUSH_EVENT_THRESHOLD = 50;
26261
26306
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
26262
26307
  function getCdkdVersion() {
26263
- return "0.284.37";
26308
+ return "0.284.39";
26264
26309
  }
26265
26310
  /**
26266
26311
  * Generate a time-sortable unique run id, e.g.
@@ -27366,8 +27411,8 @@ var DeployEngine = class {
27366
27411
  process.removeListener("SIGINT", sigintHandler);
27367
27412
  throw error;
27368
27413
  }
27369
- renderer.start();
27370
27414
  try {
27415
+ renderer.start();
27371
27416
  const currentStateData = await this.stateBackend.getState(stackName, this.stackRegion);
27372
27417
  const currentState = currentStateData?.state ?? {
27373
27418
  version: 8,
@@ -27514,7 +27559,9 @@ var DeployEngine = class {
27514
27559
  attributeFallbackCount: this.resolver.getPhysicalIdFallbackCount()
27515
27560
  };
27516
27561
  } finally {
27517
- renderer.stop();
27562
+ try {
27563
+ renderer.stop();
27564
+ } catch {}
27518
27565
  process.removeListener("SIGINT", sigintHandler);
27519
27566
  this.observedCaptureTasks.clear();
27520
27567
  try {
@@ -28880,5 +28927,5 @@ var DeployEngine = class {
28880
28927
  };
28881
28928
 
28882
28929
  //#endregion
28883
- export { startInterruptWatch as $, ConfigError as $n, buildAssetRedirectMap as $t, renderStatefulReason as A, resolveStateBucketWithDefaultAndSource as An, redactSecretsForState as At, exportAliasCollisionScrubWarning as B, PARTITION_TABLE as Bn, DiffCalculator as Bt, isFinalSnapshotError as C, getDefaultStateBucketName as Cn, isRetryableTransientError as Cr, TEMPLATE_SOURCED_RULES as Ct, extractDeploymentEventError as D, resolveCaptureObservedState as Dn, isSingleDynamicReferenceToken as Dt, makeCanonicalizePropertiesFn as E, resolveAutoAssetStorage as En, __exportAll as Er, errorCauseChain as Et, green as F, CFN_TEMPLATE_URL_LIMIT as Fn, s3BucketDomainName as Ft, collectInlinePolicyNamesManagedBySiblings as G, clearBucketRegionCache as Gn, TemplateParser as Gt, secretBearingStateKeyWarning as H, derivePartitionAndUrlSuffix as Hn, describeTypeWithThrottleRetry as Ht, red as I, MIGRATE_TMP_PREFIX as In, s3BucketDualStackDomainName as It, findActionableSilentDrops as J, getAwsClients as Jn, rebuildClientForBucketRegion as Jt, clearOnUpdateRemoval as K, resolveBucketRegion as Kn, LockManager as Kt, yellow as L, findLargeInlineResources as Ln, s3BucketRegionalDomainName as Lt, bold as M, stateBucketExistenceConfirmed as Mn, classifyReplaySecretRegion as Mt, cyan as N, warnDeprecatedNoPrefixCliFlag as Nn, producerRegionsFromState as Nt, MULTI_REGION_RECREATE_BLOCKED_TYPES as O, resolveSkipPrefix as On, maskSecretsInError as Ot, gray as P, CFN_TEMPLATE_BODY_LIMIT as Pn, s3BucketArn as Pt, isInterruptedWaitError as Q, CdkdError as Qn, WorkGraph as Qt, collectDeclaredOutputNames as R, uploadCfnTemplate as Rn, s3BucketWebsiteUrl as Rt, createPreDeleteFinalSnapshot as S, synthesisStatusMessage as Sn, isMarkedNonRetryable as Sr, STATE_SOURCED_READBACK_RULES as St, unsupportedFinalSnapshotError as T, resolveApp as Tn, markNonRetryable as Tr, dynamicReferenceTokens as Tt, stateKeySecretExposure as U, AssemblyReader as Un, withRetry as Ut, isExportAliasCollision as V, canonicalizeRegion as Vn, INTRINSIC_KEYS as Vt, IAMRoleProvider as W, processStackMessages as Wn, DagBuilder as Wt, beginCommandInterruptScope as X, setAwsClients as Xn, AssetPublisher as Xt, findSilentDropProperties as Y, resetAwsClients as Yn, shouldRetainResource as Yt, endCommandInterruptScope as Z, AssetError as Zn, stringifyValue as Zt, computeImplicitDeleteEdges as _, runDockerForeground as _n, SynthesisError as _r, replayWarn as _t, DeploymentEventsStore as a, AssetModeResolver as an, LocalMigrateError as ar, carriesDynamicReference as at, buildFinalSnapshotIdentifier as b, getDockerImageBySourceHash as bn, normalizeAwsError as br, requireConfigString as bt, replayFailedOperations as c, getBootstrapMarkerKey as cn, MissingCdkCliError as cr, refStateLookupFromResource as ct, updatePartialReason as d, validateAssetBucketName as dn, ProvisioningError as dr, resolveExplicitPhysicalId as dt, createAssetRedirectResolver as en, CrossAccountSecretRefusalError as er, CloudControlProvider as et, UNSPECIFIED_SKIP_REASON as f, validateContainerRepoName as fn, ResourceTimeoutError as fr, assertRegionMatch as ft, IMPLICIT_DELETE_DEPENDENCIES as g, getDockerCmd as gn, StateError as gr, readConfigString as gt, maskingRetryLogger as h, formatDockerLoginError as hn, StackTerminationProtectionError as hr, configStringRefusal as ht, DeploymentEventsReader as i, stripControlChars as in, LocalInvokeBuildError as ir, IntrinsicFunctionResolver as it, formatResourceLine as j, resolveUseCdkBootstrapAssets as jn, scrubResourceRecord as jt, isStatefulRecreateTargetSync as k, resolveStateBucketWithDefault as kn, maskSecretsInText as kt, replayRollback as l, parseBootstrapMarker as ln, NestedStackChildDirectDestroyError as lr, WAFv2WebACLProvider as lt, withResourceDeadline as m, buildDockerImage as mn, StackHasActiveImportsError as mr, configBooleanRefusal as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, rewriteTemplateAssetReferences as nn, DeployCancelledError as nr, disableInstanceApiTermination as nt, planFailedOps as o, BOOTSTRAP_MARKER_PREFIX as on, LocalStartServiceError as or, cfnRefValueFromPhysicalId as ot, deleteSkipReason as p, buildDenyExternalAccessPolicy as pn, ResourceUpdateNotSupportedError as pr, coerceCfnBoolean as pt, ProviderRegistry as q, AwsClients as qn, S3StateBackend as qt, DeployEngine as r, escapeRegExp$1 as rn, DynamicReferenceRegionAmbiguousError as rr, isTerminationProtectionPropagationError as rt, planRollback as s, ensureAssetStorage as sn, LockError as sr, getAccountInfo as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, loadPublishableAssetManifest as tn, DependencyError as tr, slowCcOperationTimeoutMs as tt, updatePartialMessage as u, readBootstrapMarkerBody as un, PartialFailureError as ur, normalizeAwsTagsToCfn as ut, ATOMIC_FINAL_SNAPSHOT_TYPES as v, runDockerStreaming as vn, formatError as vr, requireConfigArray as vt, refusesFinalSnapshot as w, getLegacyStateBucketName as wn, isThrottlingError as wr, createSecretMasker as wt, ccRoutedFinalSnapshotError as x, Synthesizer as xn, withErrorHandling as xr, STATE_SOURCED_CROSS_GENERATION_RULES as xt, PRE_DELETE_SNAPSHOT_TYPES as y, AssetManifestLoader as yn, isCdkdError as yr, requireConfigObject as yt, collectPublishedOutputNames as z, expectedOwnerParam as zn, applyRoleArnIfSet as zt };
28884
- //# sourceMappingURL=deploy-engine-C62UGXid.js.map
28930
+ export { startInterruptWatch as $, CdkdError as $n, WorkGraph as $t, renderStatefulReason as A, resolveStateBucketWithDefault as An, redactSecretsForState as At, exportAliasCollisionScrubWarning as B, expectedOwnerParam as Bn, DiffCalculator as Bt, isFinalSnapshotError as C, synthesisStatusMessage as Cn, isMarkedNonRetryable as Cr, TEMPLATE_SOURCED_RULES as Ct, extractDeploymentEventError as D, resolveAutoAssetStorage as Dn, __exportAll as Dr, isSingleDynamicReferenceToken as Dt, makeCanonicalizePropertiesFn as E, resolveApp as En, markNonRetryable as Er, errorCauseChain as Et, green as F, CFN_TEMPLATE_BODY_LIMIT as Fn, s3BucketDomainName as Ft, collectInlinePolicyNamesManagedBySiblings as G, processStackMessages as Gn, TemplateParser as Gt, secretBearingStateKeyWarning as H, canonicalizeRegion as Hn, describeTypeWithThrottleRetry as Ht, red as I, CFN_TEMPLATE_URL_LIMIT as In, s3BucketDualStackDomainName as It, findActionableSilentDrops as J, AwsClients as Jn, S3StateBackend as Jt, clearOnUpdateRemoval as K, clearBucketRegionCache as Kn, LockManager as Kt, yellow as L, MIGRATE_TMP_PREFIX as Ln, s3BucketRegionalDomainName as Lt, bold as M, resolveUseCdkBootstrapAssets as Mn, classifyReplaySecretRegion as Mt, cyan as N, stateBucketExistenceConfirmed as Nn, producerRegionsFromState as Nt, MULTI_REGION_RECREATE_BLOCKED_TYPES as O, resolveCaptureObservedState as On, maskSecretsInError as Ot, gray as P, warnDeprecatedNoPrefixCliFlag as Pn, s3BucketArn as Pt, isInterruptedWaitError as Q, AssetError as Qn, stringifyValue as Qt, collectDeclaredOutputNames as R, findLargeInlineResources as Rn, s3BucketWebsiteUrl as Rt, createPreDeleteFinalSnapshot as S, Synthesizer as Sn, withErrorHandling as Sr, STATE_SOURCED_READBACK_RULES as St, unsupportedFinalSnapshotError as T, getLegacyStateBucketName as Tn, isThrottlingError as Tr, dynamicReferenceTokens as Tt, stateKeySecretExposure as U, derivePartitionAndUrlSuffix as Un, withRetry as Ut, isExportAliasCollision as V, PARTITION_TABLE as Vn, INTRINSIC_KEYS as Vt, IAMRoleProvider as W, AssemblyReader as Wn, DagBuilder as Wt, beginCommandInterruptScope as X, resetAwsClients as Xn, shouldRetainResource as Xt, findSilentDropProperties as Y, getAwsClients as Yn, rebuildClientForBucketRegion as Yt, endCommandInterruptScope as Z, setAwsClients as Zn, AssetPublisher as Zt, computeImplicitDeleteEdges as _, getDockerCmd as _n, StateError as _r, replayWarn as _t, DeploymentEventsStore as a, stripControlChars as an, LocalInvokeBuildError as ar, carriesDynamicReference as at, buildFinalSnapshotIdentifier as b, AssetManifestLoader as bn, isCdkdError as br, requireConfigString as bt, replayFailedOperations as c, ensureAssetStorage as cn, LockError as cr, refStateLookupFromResource as ct, updatePartialReason as d, readBootstrapMarkerBody as dn, PartialFailureError as dr, resolveExplicitPhysicalId as dt, buildAssetRedirectMap as en, ConfigError as er, CloudControlProvider as et, UNSPECIFIED_SKIP_REASON as f, validateAssetBucketName as fn, ProvisioningError as fr, assertRegionMatch as ft, IMPLICIT_DELETE_DEPENDENCIES as g, formatDockerLoginError as gn, StackTerminationProtectionError as gr, readConfigString as gt, maskingRetryLogger as h, buildDockerImage as hn, StackHasActiveImportsError as hr, configStringRefusal as ht, DeploymentEventsReader as i, escapeRegExp$1 as in, DynamicReferenceRegionAmbiguousError as ir, IntrinsicFunctionResolver as it, formatResourceLine as j, resolveStateBucketWithDefaultAndSource as jn, scrubResourceRecord as jt, isStatefulRecreateTargetSync as k, resolveSkipPrefix as kn, maskSecretsInText as kt, replayRollback as l, getBootstrapMarkerKey as ln, MissingCdkCliError as lr, WAFv2WebACLProvider as lt, withResourceDeadline as m, buildDenyExternalAccessPolicy as mn, ResourceUpdateNotSupportedError as mr, configBooleanRefusal as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, loadPublishableAssetManifest as nn, DependencyError as nr, disableInstanceApiTermination as nt, planFailedOps as o, AssetModeResolver as on, LocalMigrateError as or, cfnRefValueFromPhysicalId as ot, deleteSkipReason as p, validateContainerRepoName as pn, ResourceTimeoutError as pr, coerceCfnBoolean as pt, ProviderRegistry as q, resolveBucketRegion as qn, displaySafe as qt, DeployEngine as r, rewriteTemplateAssetReferences as rn, DeployCancelledError as rr, isTerminationProtectionPropagationError as rt, planRollback as s, BOOTSTRAP_MARKER_PREFIX as sn, LocalStartServiceError as sr, getAccountInfo as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, createAssetRedirectResolver as tn, CrossAccountSecretRefusalError as tr, slowCcOperationTimeoutMs as tt, updatePartialMessage as u, parseBootstrapMarker as un, NestedStackChildDirectDestroyError as ur, normalizeAwsTagsToCfn as ut, ATOMIC_FINAL_SNAPSHOT_TYPES as v, runDockerForeground as vn, SynthesisError as vr, requireConfigArray as vt, refusesFinalSnapshot as w, getDefaultStateBucketName as wn, isRetryableTransientError as wr, createSecretMasker as wt, ccRoutedFinalSnapshotError as x, getDockerImageBySourceHash as xn, normalizeAwsError as xr, STATE_SOURCED_CROSS_GENERATION_RULES as xt, PRE_DELETE_SNAPSHOT_TYPES as y, runDockerStreaming as yn, formatError as yr, requireConfigObject as yt, collectPublishedOutputNames as z, uploadCfnTemplate as zn, applyRoleArnIfSet as zt };
28931
+ //# sourceMappingURL=deploy-engine-rKBFVifY.js.map