@go-to-k/cdkd 0.284.42 → 0.284.44
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/{asg-provider-Dn9oXi9c.js → asg-provider-D33XE2vS.js} +2 -2
- package/dist/{asg-provider-Dn9oXi9c.js.map → asg-provider-D33XE2vS.js.map} +1 -1
- package/dist/cli.js +34 -20
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-8ygMMbQ8.js → deploy-engine-B4dbov9o.js} +182 -4
- package/dist/deploy-engine-B4dbov9o.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-8ygMMbQ8.js.map +0 -1
|
@@ -5102,6 +5102,184 @@ function formatDockerLoginError(stderr, endpoint) {
|
|
|
5102
5102
|
if (trimmed.includes("already exists in the keychain") || trimmed.includes("Error saving credentials")) return `docker's credential helper (osxkeychain on macOS / wincred on Windows / pass / secretservice on Linux) failed to persist the ECR auth token. The "already exists in the keychain" / "Error saving credentials" output is a known docker-credential-helpers issue — unrelated to cdkd, AWS credentials, or IAM perms. Quick fix: run \`docker logout ${endpoint}\` to clear the stale entry, then retry the cdkd command. Permanent fix: edit ~/.docker/config.json and remove (or empty) the platform-specific "credsStore" entry (e.g. "osxkeychain" → "" or "desktop" on macOS Docker Desktop). Original docker stderr: ${trimmed}`;
|
|
5103
5103
|
return trimmed;
|
|
5104
5104
|
}
|
|
5105
|
+
/**
|
|
5106
|
+
* Env vars the docker CLI itself reads to decide how / where to run. A resolved
|
|
5107
|
+
* ECS secret (or SecureString) whose NAME collides with one of these must NOT
|
|
5108
|
+
* override it in the docker client's own process environment: a secret named
|
|
5109
|
+
* `DOCKER_HOST` would redirect the client to a different daemon, and `PATH`
|
|
5110
|
+
* would break locating the docker binary. See issue
|
|
5111
|
+
* https://github.com/go-to-k/cdkd/issues/2183.
|
|
5112
|
+
*/
|
|
5113
|
+
const DOCKER_CLIENT_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
5114
|
+
"PATH",
|
|
5115
|
+
"PATHEXT",
|
|
5116
|
+
"HOME",
|
|
5117
|
+
"USERPROFILE",
|
|
5118
|
+
"HOMEDRIVE",
|
|
5119
|
+
"HOMEPATH",
|
|
5120
|
+
"DOCKER_HOST",
|
|
5121
|
+
"DOCKER_CONTEXT",
|
|
5122
|
+
"DOCKER_CONFIG",
|
|
5123
|
+
"DOCKER_CERT_PATH",
|
|
5124
|
+
"DOCKER_TLS",
|
|
5125
|
+
"DOCKER_TLS_VERIFY",
|
|
5126
|
+
"DOCKER_API_VERSION",
|
|
5127
|
+
"DOCKER_AUTH_CONFIG",
|
|
5128
|
+
"DOCKER_DEFAULT_PLATFORM",
|
|
5129
|
+
"DOCKER_CUSTOM_HEADERS",
|
|
5130
|
+
"DOCKER_CONTENT_TRUST",
|
|
5131
|
+
"DOCKER_CONTENT_TRUST_SERVER",
|
|
5132
|
+
"DOCKER_HIDE_LEGACY_COMMANDS",
|
|
5133
|
+
"BUILDKIT_PROGRESS",
|
|
5134
|
+
"GLIBC_TUNABLES",
|
|
5135
|
+
"GCONV_PATH",
|
|
5136
|
+
"BASH_ENV",
|
|
5137
|
+
"SSH_AUTH_SOCK",
|
|
5138
|
+
"SSH_ASKPASS",
|
|
5139
|
+
"SSH_ASKPASS_REQUIRE",
|
|
5140
|
+
"SSH_SK_HELPER",
|
|
5141
|
+
"SSH_SK_PROVIDER",
|
|
5142
|
+
"SSH_PKCS11_HELPER",
|
|
5143
|
+
"SSH_AGENT_PID",
|
|
5144
|
+
"AWS_ENDPOINT_URL",
|
|
5145
|
+
"AWS_CA_BUNDLE",
|
|
5146
|
+
"AWS_PROFILE",
|
|
5147
|
+
"AWS_CONFIG_FILE",
|
|
5148
|
+
"AWS_SHARED_CREDENTIALS_FILE",
|
|
5149
|
+
"AWS_WEB_IDENTITY_TOKEN_FILE",
|
|
5150
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
5151
|
+
"AWS_ROLE_ARN",
|
|
5152
|
+
"AWS_EC2_METADATA_SERVICE_ENDPOINT",
|
|
5153
|
+
"SSL_CERT_FILE",
|
|
5154
|
+
"SSL_CERT_DIR",
|
|
5155
|
+
"GODEBUG",
|
|
5156
|
+
"HTTP_PROXY",
|
|
5157
|
+
"HTTPS_PROXY",
|
|
5158
|
+
"NO_PROXY",
|
|
5159
|
+
"FTP_PROXY",
|
|
5160
|
+
"ALL_PROXY"
|
|
5161
|
+
]);
|
|
5162
|
+
const DOCKER_CLIENT_ENV_KEYS_UPPER = new Set([...DOCKER_CLIENT_ENV_KEYS].map((k) => k.toUpperCase()));
|
|
5163
|
+
/**
|
|
5164
|
+
* Env-var prefixes whose WHOLE family the docker client (or a helper it execs)
|
|
5165
|
+
* reads, so a NAMED list is always one release behind and a colliding secret in
|
|
5166
|
+
* ANY member is a hazard. `LD_*` / `DYLD_*` are the dynamic loader (code
|
|
5167
|
+
* injection, glibc + macOS); `AWS_ENDPOINT_URL_*` is the per-service endpoint
|
|
5168
|
+
* family aws-sdk-go-v2 (and so `docker-credential-ecr-login`) honours — a
|
|
5169
|
+
* secret named `AWS_ENDPOINT_URL_ECR` walks around the exact
|
|
5170
|
+
* `AWS_ENDPOINT_URL` entry and redirects a request signed with the operator's
|
|
5171
|
+
* real credentials (#2186 round 4). No plausible secret name collides with
|
|
5172
|
+
* any of the three. Matched by prefix rather than enumerated (issue #2183
|
|
5173
|
+
* review). `SSH_` was a prefix here and was demoted to an EXACT enumeration
|
|
5174
|
+
* in {@link DOCKER_CLIENT_ENV_KEYS} (#2186 review round 3): the family is not
|
|
5175
|
+
* uniformly dangerous and is not growing, while the prefix broke realistic,
|
|
5176
|
+
* currently-working secrets (`SSH_PRIVATE_KEY`, GitLab CI's canonical
|
|
5177
|
+
* deploy-key spelling). Exported so the test fence can assert the EXACT
|
|
5178
|
+
* contents — a hardcoded copy in the test made the anti-shadowing fence
|
|
5179
|
+
* one-directional (#2186 round 4 finding 2).
|
|
5180
|
+
*/
|
|
5181
|
+
const DOCKER_CLIENT_ENV_PREFIXES = [
|
|
5182
|
+
"LD_",
|
|
5183
|
+
"DYLD_",
|
|
5184
|
+
"AWS_ENDPOINT_URL_"
|
|
5185
|
+
];
|
|
5186
|
+
/**
|
|
5187
|
+
* Is `key` the name of a var the docker client reads? Case-INSENSITIVE, because
|
|
5188
|
+
* Windows environment lookups are, so a lowercase `docker_host` must be caught
|
|
5189
|
+
* too (issue #2183). Matches the exact denylist OR a prefixed family — the
|
|
5190
|
+
* prefix families are fail-closed on the whole prefix, so an unlisted `LD_*` /
|
|
5191
|
+
* `DYLD_*` / `AWS_ENDPOINT_URL_*` secret is dropped (with a rename warning)
|
|
5192
|
+
* rather than reaching the client.
|
|
5193
|
+
*/
|
|
5194
|
+
function isDockerClientEnvKey(key) {
|
|
5195
|
+
const upper = key.toUpperCase();
|
|
5196
|
+
if (DOCKER_CLIENT_ENV_KEYS_UPPER.has(upper)) return true;
|
|
5197
|
+
return DOCKER_CLIENT_ENV_PREFIXES.some((prefix) => upper.startsWith(prefix));
|
|
5198
|
+
}
|
|
5199
|
+
/**
|
|
5200
|
+
* Is `key` a shape that cannot be a well-formed `docker run -e` variable NAME?
|
|
5201
|
+
* Defined POSITIVELY as the good shape's complement (#2186 round 5): a valid
|
|
5202
|
+
* name is non-empty and contains neither `=` nor NUL. Enumerating the bad
|
|
5203
|
+
* spellings one at a time closed `=` in round 4 and left the empty key (`-e ''`
|
|
5204
|
+
* — docker rejects it with an opaque error naming no secret) and a NUL-bearing
|
|
5205
|
+
* key still open. A sensitive key matching this takes the same fail-closed
|
|
5206
|
+
* collision path as a docker-client-var name: no `-e` flag, no spawn-env entry,
|
|
5207
|
+
* reported in `collisions`. (This is the NAME only; a secret VALUE containing a
|
|
5208
|
+
* NUL is a separate pre-existing leak tracked in issue #2189.)
|
|
5209
|
+
*/
|
|
5210
|
+
function isMalformedEnvKey(key) {
|
|
5211
|
+
return key.length === 0 || key.includes("=") || key.includes("\0");
|
|
5212
|
+
}
|
|
5213
|
+
/**
|
|
5214
|
+
* Split a container's environment into `docker run` `-e` flags and the values
|
|
5215
|
+
* that must travel through the spawn env instead of the argv.
|
|
5216
|
+
*
|
|
5217
|
+
* - a NON-sensitive key becomes `-e KEY=value` on the argv (unchanged);
|
|
5218
|
+
* - a sensitive key becomes a value-less `-e KEY`, its value returned in
|
|
5219
|
+
* `sensitiveEnv` for {@link dockerSpawnEnvWithSensitive};
|
|
5220
|
+
* - a sensitive key that NAMES a docker-client var ({@link isDockerClientEnvKey}
|
|
5221
|
+
* — the exact denylist plus the prefix families, so an external caller must
|
|
5222
|
+
* use the predicate, not `DOCKER_CLIENT_ENV_KEYS.has`) gets NO flag at all,
|
|
5223
|
+
* its value is dropped, and the key is reported in `collisions` so the
|
|
5224
|
+
* caller can warn;
|
|
5225
|
+
* - a sensitive key of a MALFORMED shape ({@link isMalformedEnvKey} — empty,
|
|
5226
|
+
* or containing `=` / NUL) takes the same fail-closed path (#2186 rounds
|
|
5227
|
+
* 4-5). The denylist matches the WHOLE key string, but Node serialises env
|
|
5228
|
+
* as `key=value` and the OS parses the variable NAME as everything before
|
|
5229
|
+
* the FIRST `=` — so a secret named `PATH=/tmp/evil:` is not a denylist
|
|
5230
|
+
* match while the environ it produces (`PATH=/tmp/evil:=<secret>`) POISONS
|
|
5231
|
+
* the client's `PATH`, and the poisoned duplicate wins (measured). The
|
|
5232
|
+
* docker CLI execs `docker-credential-*` helpers off `PATH`, so that is code
|
|
5233
|
+
* execution as the operator. Defining the GOOD shape positively also catches
|
|
5234
|
+
* the empty key (`-e ''`, an opaque docker rejection) in one predicate.
|
|
5235
|
+
*
|
|
5236
|
+
* The collision case is why the argv half lives here beside the env half.
|
|
5237
|
+
* Emitting `-e KEY` for a key that `dockerSpawnEnvWithSensitive` refuses to
|
|
5238
|
+
* set makes docker resolve the flag against the CLIENT's own environment, so
|
|
5239
|
+
* the container silently receives the HOST's value for that var (issue #2183)
|
|
5240
|
+
* -- e.g. the host's `HTTPS_PROXY` credential, or a macOS `PATH` inside a
|
|
5241
|
+
* Linux image. Dropping the flag is what makes "not forwarded" literally true.
|
|
5242
|
+
*/
|
|
5243
|
+
function partitionSensitiveEnv(env, sensitiveKeys) {
|
|
5244
|
+
const flags = [];
|
|
5245
|
+
const sensitiveEnv = {};
|
|
5246
|
+
const collisions = [];
|
|
5247
|
+
for (const [k, v] of Object.entries(env)) {
|
|
5248
|
+
if (!sensitiveKeys.has(k)) {
|
|
5249
|
+
flags.push("-e", `${k}=${v}`);
|
|
5250
|
+
continue;
|
|
5251
|
+
}
|
|
5252
|
+
if (isMalformedEnvKey(k) || isDockerClientEnvKey(k)) {
|
|
5253
|
+
collisions.push(k);
|
|
5254
|
+
continue;
|
|
5255
|
+
}
|
|
5256
|
+
flags.push("-e", k);
|
|
5257
|
+
sensitiveEnv[k] = v;
|
|
5258
|
+
}
|
|
5259
|
+
return {
|
|
5260
|
+
flags,
|
|
5261
|
+
sensitiveEnv,
|
|
5262
|
+
collisions
|
|
5263
|
+
};
|
|
5264
|
+
}
|
|
5265
|
+
/**
|
|
5266
|
+
* Build the environment for a `docker run` that forwards value-less `-e KEY`
|
|
5267
|
+
* flags (the pattern that keeps secret VALUES off the argv / `/proc/<pid>/cmdline`).
|
|
5268
|
+
* The child gets the full parent env plus the sensitive passthrough, but the
|
|
5269
|
+
* docker client's own critical vars ({@link isDockerClientEnvKey}) are kept
|
|
5270
|
+
* authoritative from `process.env`, so a user-controlled secret NAME cannot
|
|
5271
|
+
* hijack the client (issue #2183). Callers should partition through
|
|
5272
|
+
* {@link partitionSensitiveEnv}, which never puts a colliding key in
|
|
5273
|
+
* `sensitiveEnv`; the guard here is defence in depth.
|
|
5274
|
+
*/
|
|
5275
|
+
function dockerSpawnEnvWithSensitive(sensitiveEnv) {
|
|
5276
|
+
const env = { ...process.env };
|
|
5277
|
+
for (const [k, v] of Object.entries(sensitiveEnv)) {
|
|
5278
|
+
if (isMalformedEnvKey(k) || isDockerClientEnvKey(k)) continue;
|
|
5279
|
+
env[k] = v;
|
|
5280
|
+
}
|
|
5281
|
+
return env;
|
|
5282
|
+
}
|
|
5105
5283
|
function mergeEnv(overrides) {
|
|
5106
5284
|
const merged = { ...process.env };
|
|
5107
5285
|
for (const [k, v] of Object.entries(overrides)) if (v === void 0) delete merged[k];
|
|
@@ -17985,7 +18163,7 @@ var CloudControlProvider = class {
|
|
|
17985
18163
|
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);
|
|
17986
18164
|
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
17987
18165
|
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
17988
|
-
const { ASGProvider } = await import("./asg-provider-
|
|
18166
|
+
const { ASGProvider } = await import("./asg-provider-D33XE2vS.js").then((n) => n.n);
|
|
17989
18167
|
return await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
|
|
17990
18168
|
}
|
|
17991
18169
|
const isProtectedEc2Instance = context?.removeProtection === true && resourceType === "AWS::EC2::Instance";
|
|
@@ -26681,7 +26859,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
26681
26859
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
26682
26860
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
26683
26861
|
function getCdkdVersion() {
|
|
26684
|
-
return "0.284.
|
|
26862
|
+
return "0.284.44";
|
|
26685
26863
|
}
|
|
26686
26864
|
/**
|
|
26687
26865
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -29303,5 +29481,5 @@ var DeployEngine = class {
|
|
|
29303
29481
|
};
|
|
29304
29482
|
|
|
29305
29483
|
//#endregion
|
|
29306
|
-
export { startInterruptWatch as $,
|
|
29307
|
-
//# sourceMappingURL=deploy-engine-
|
|
29484
|
+
export { startInterruptWatch as $, setAwsClients as $n, WorkGraph as $t, renderStatefulReason as A, resolveCaptureObservedState as An, redactSecretsForState as At, exportAliasCollisionScrubWarning as B, findLargeInlineResources as Bn, DiffCalculator as Bt, isFinalSnapshotError as C, getDockerImageBySourceHash as Cn, normalizeAwsError as Cr, TEMPLATE_SOURCED_RULES as Ct, extractDeploymentEventError as D, getLegacyStateBucketName as Dn, isThrottlingError as Dr, isSingleDynamicReferenceToken as Dt, makeCanonicalizePropertiesFn as E, getDefaultStateBucketName as En, isRetryableTransientError as Er, errorCauseChain as Et, green as F, stateBucketExistenceConfirmed as Fn, s3BucketDomainName as Ft, collectInlinePolicyNamesManagedBySiblings as G, derivePartitionAndUrlSuffix as Gn, TemplateParser as Gt, secretBearingStateKeyWarning as H, expectedOwnerParam as Hn, describeTypeWithThrottleRetry as Ht, red as I, warnDeprecatedNoPrefixCliFlag as In, s3BucketDualStackDomainName as It, findActionableSilentDrops as J, clearBucketRegionCache as Jn, S3StateBackend as Jt, clearOnUpdateRemoval as K, AssemblyReader as Kn, LockManager as Kt, yellow as L, CFN_TEMPLATE_BODY_LIMIT as Ln, s3BucketRegionalDomainName as Lt, bold as M, resolveStateBucketWithDefault as Mn, classifyReplaySecretRegion as Mt, cyan as N, resolveStateBucketWithDefaultAndSource as Nn, producerRegionsFromState as Nt, MULTI_REGION_RECREATE_BLOCKED_TYPES as O, resolveApp as On, markNonRetryable as Or, maskSecretsInError as Ot, gray as P, resolveUseCdkBootstrapAssets as Pn, s3BucketArn as Pt, isInterruptedWaitError as Q, resetAwsClients as Qn, stringifyValue as Qt, collectDeclaredOutputNames as R, CFN_TEMPLATE_URL_LIMIT as Rn, s3BucketWebsiteUrl as Rt, createPreDeleteFinalSnapshot as S, AssetManifestLoader as Sn, isCdkdError as Sr, STATE_SOURCED_READBACK_RULES as St, unsupportedFinalSnapshotError as T, synthesisStatusMessage as Tn, isMarkedNonRetryable as Tr, dynamicReferenceTokens as Tt, stateKeySecretExposure as U, PARTITION_TABLE as Un, withRetry as Ut, isExportAliasCollision as V, uploadCfnTemplate as Vn, INTRINSIC_KEYS as Vt, IAMRoleProvider as W, canonicalizeRegion as Wn, DagBuilder as Wt, beginCommandInterruptScope as X, AwsClients as Xn, shouldRetainResource as Xt, findSilentDropProperties as Y, resolveBucketRegion as Yn, rebuildClientForBucketRegion as Yt, endCommandInterruptScope as Z, getAwsClients as Zn, AssetPublisher as Zt, computeImplicitDeleteEdges as _, formatDockerLoginError as _n, StackHasActiveImportsError as _r, replayWarn as _t, DeploymentEventsStore as a, stripControlChars as an, DeployCancelledError as ar, carriesDynamicReference as at, buildFinalSnapshotIdentifier as b, runDockerForeground as bn, SynthesisError as br, requireConfigString as bt, replayFailedOperations as c, ensureAssetStorage as cn, LocalMigrateError as cr, refStateLookupFromResource as ct, updatePartialReason as d, readBootstrapMarkerBody as dn, MissingCdkCliError as dr, resolveExplicitPhysicalId as dt, buildAssetRedirectMap as en, AssetError as er, CloudControlProvider as et, UNSPECIFIED_SKIP_REASON as f, validateAssetBucketName as fn, NestedStackChildDirectDestroyError as fr, assertRegionMatch as ft, IMPLICIT_DELETE_DEPENDENCIES as g, dockerSpawnEnvWithSensitive as gn, ResourceUpdateNotSupportedError as gr, readConfigString as gt, maskingRetryLogger as h, buildDockerImage as hn, ResourceTimeoutError as hr, configStringRefusal as ht, DeploymentEventsReader as i, escapeRegExp$1 as in, DependencyError as ir, IntrinsicFunctionResolver as it, formatResourceLine as j, resolveSkipPrefix as jn, scrubResourceRecord as jt, isStatefulRecreateTargetSync as k, resolveAutoAssetStorage as kn, __exportAll as kr, maskSecretsInText as kt, replayRollback as l, getBootstrapMarkerKey as ln, LocalStartServiceError as lr, WAFv2WebACLProvider as lt, withResourceDeadline as m, buildDenyExternalAccessPolicy as mn, ProvisioningError as mr, configBooleanRefusal as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, loadPublishableAssetManifest as nn, ConfigError as nr, disableInstanceApiTermination as nt, planFailedOps as o, AssetModeResolver as on, DynamicReferenceRegionAmbiguousError as or, cfnRefValueFromPhysicalId as ot, deleteSkipReason as p, validateContainerRepoName as pn, PartialFailureError as pr, coerceCfnBoolean as pt, ProviderRegistry as q, processStackMessages as qn, displaySafe as qt, DeployEngine as r, rewriteTemplateAssetReferences as rn, CrossAccountSecretRefusalError as rr, isTerminationProtectionPropagationError as rt, planRollback as s, BOOTSTRAP_MARKER_PREFIX as sn, LocalInvokeBuildError as sr, getAccountInfo as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, createAssetRedirectResolver as tn, CdkdError as tr, slowCcOperationTimeoutMs as tt, updatePartialMessage as u, parseBootstrapMarker as un, LockError as ur, normalizeAwsTagsToCfn as ut, ATOMIC_FINAL_SNAPSHOT_TYPES as v, getDockerCmd as vn, StackTerminationProtectionError as vr, requireConfigArray as vt, refusesFinalSnapshot as w, Synthesizer as wn, withErrorHandling as wr, createSecretMasker as wt, ccRoutedFinalSnapshotError as x, runDockerStreaming as xn, formatError as xr, STATE_SOURCED_CROSS_GENERATION_RULES as xt, PRE_DELETE_SNAPSHOT_TYPES as y, partitionSensitiveEnv as yn, StateError as yr, requireConfigObject as yt, collectPublishedOutputNames as z, MIGRATE_TMP_PREFIX as zn, applyRoleArnIfSet as zt };
|
|
29485
|
+
//# sourceMappingURL=deploy-engine-B4dbov9o.js.map
|