cdk-local 0.149.5 → 0.149.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/{docker-cmd-B5yU__zC.js → docker-cmd-leyvDn1u.js} +232 -2
- package/dist/{docker-cmd-B5yU__zC.js.map → docker-cmd-leyvDn1u.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +2 -2
- package/dist/local-studio-D-j3TZWX.d.ts.map +1 -1
- package/dist/{local-studio-CV21zLBM.js → local-studio-U-gD2HSf.js} +364 -101
- package/dist/local-studio-U-gD2HSf.js.map +1 -0
- package/package.json +1 -1
- package/dist/local-studio-CV21zLBM.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as createLocalStartAgentCoreCommand, F as createLocalStartCloudFrontCommand, Mn as createLocalInvokeCommand, Ot as createLocalStartServiceCommand, Pn as createLocalStartApiCommand, St as createLocalStartAlbCommand, a as createLocalStudioCommand, jt as createLocalRunTaskCommand, sn as createLocalInvokeAgentCoreCommand, w as createLocalListCommand } from "./local-studio-
|
|
2
|
+
import { D as createLocalStartAgentCoreCommand, F as createLocalStartCloudFrontCommand, Mn as createLocalInvokeCommand, Ot as createLocalStartServiceCommand, Pn as createLocalStartApiCommand, St as createLocalStartAlbCommand, a as createLocalStudioCommand, jt as createLocalRunTaskCommand, sn as createLocalInvokeAgentCoreCommand, w as createLocalListCommand } from "./local-studio-U-gD2HSf.js";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
|
|
5
5
|
//#region src/cli/index.ts
|
|
6
6
|
const program = new Command();
|
|
7
|
-
program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.149.
|
|
7
|
+
program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.149.7");
|
|
8
8
|
program.addCommand(createLocalInvokeCommand());
|
|
9
9
|
program.addCommand(createLocalInvokeAgentCoreCommand());
|
|
10
10
|
program.addCommand(createLocalStartApiCommand());
|
|
@@ -1109,11 +1109,16 @@ function displayUntrustedValue(value) {
|
|
|
1109
1109
|
//#endregion
|
|
1110
1110
|
//#region src/utils/docker-cmd.ts
|
|
1111
1111
|
var docker_cmd_exports = /* @__PURE__ */ __exportAll({
|
|
1112
|
+
DOCKER_CLIENT_ENV_KEYS: () => DOCKER_CLIENT_ENV_KEYS,
|
|
1113
|
+
DOCKER_CLIENT_ENV_PREFIXES: () => DOCKER_CLIENT_ENV_PREFIXES,
|
|
1114
|
+
DOCKER_CLIENT_ENV_PREFIX_EXEMPTIONS: () => DOCKER_CLIENT_ENV_PREFIX_EXEMPTIONS,
|
|
1112
1115
|
allowSecretsOnArgvEnvName: () => allowSecretsOnArgvEnvName,
|
|
1113
1116
|
finchSecretArgvRefusal: () => finchSecretArgvRefusal,
|
|
1114
1117
|
formatDockerLoginError: () => formatDockerLoginError,
|
|
1115
1118
|
getDockerCmd: () => getDockerCmd,
|
|
1119
|
+
isDockerClientEnvKey: () => isDockerClientEnvKey,
|
|
1116
1120
|
isFinchVmClient: () => isFinchVmClient,
|
|
1121
|
+
isMalformedEnvKey: () => isMalformedEnvKey,
|
|
1117
1122
|
runDockerForeground: () => runDockerForeground,
|
|
1118
1123
|
runDockerStreaming: () => runDockerStreaming,
|
|
1119
1124
|
spawnForeground: () => spawnForeground,
|
|
@@ -1423,7 +1428,232 @@ function mergeEnv(overrides) {
|
|
|
1423
1428
|
else merged[k] = v;
|
|
1424
1429
|
return merged;
|
|
1425
1430
|
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Env vars the container CLI itself reads to decide how / where to run — the
|
|
1433
|
+
* binary {@link getDockerCmd} resolves, i.e. `docker` or whatever `CDK_DOCKER`
|
|
1434
|
+
* names (podman / nerdctl / finch). A resolved ECS secret (or SecureString)
|
|
1435
|
+
* whose NAME collides with one of these must NOT override it in the client's
|
|
1436
|
+
* own process environment: a secret named `DOCKER_HOST` (or podman's
|
|
1437
|
+
* `CONTAINER_HOST`) would redirect the client to a different daemon, and `PATH`
|
|
1438
|
+
* would break locating the binary. See issues
|
|
1439
|
+
* go-to-k/cdkd#2183 and go-to-k/cdkd#2188.
|
|
1440
|
+
*
|
|
1441
|
+
* Ported from cdkd's `src/utils/docker-cmd.ts` (go-to-k/cdk-local#772) with its
|
|
1442
|
+
* lists, prefix families and rationale intact; issue references in these
|
|
1443
|
+
* comments point at cdkd, where each entry was decided. Keep the two copies
|
|
1444
|
+
* in sync.
|
|
1445
|
+
*
|
|
1446
|
+
* RULE for additions: anything a supported container CLIENT (or a credential /
|
|
1447
|
+
* connection helper it execs) reads to decide WHAT CODE IT LOADS, WHAT IT
|
|
1448
|
+
* TRUSTS, or WHERE / HOW IT CONNECTS. The docker CLI's documented set is kept
|
|
1449
|
+
* whole, behaviour toggles included; beyond it, a var that only tunes
|
|
1450
|
+
* behaviour (a storage driver, a snapshotter, a temp dir, an experimental
|
|
1451
|
+
* toggle) is OUT, because dropping a colliding secret costs the user that
|
|
1452
|
+
* secret. The operator's OWN value is never touched — the spawn
|
|
1453
|
+
* env starts from `process.env` — so adding a key costs only a secret of that
|
|
1454
|
+
* name.
|
|
1455
|
+
*/
|
|
1456
|
+
const DOCKER_CLIENT_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
1457
|
+
"PATH",
|
|
1458
|
+
"PATHEXT",
|
|
1459
|
+
"HOME",
|
|
1460
|
+
"USERPROFILE",
|
|
1461
|
+
"HOMEDRIVE",
|
|
1462
|
+
"HOMEPATH",
|
|
1463
|
+
"DOCKER_HOST",
|
|
1464
|
+
"DOCKER_CONTEXT",
|
|
1465
|
+
"DOCKER_CONFIG",
|
|
1466
|
+
"DOCKER_CERT_PATH",
|
|
1467
|
+
"DOCKER_TLS",
|
|
1468
|
+
"DOCKER_TLS_VERIFY",
|
|
1469
|
+
"DOCKER_API_VERSION",
|
|
1470
|
+
"DOCKER_AUTH_CONFIG",
|
|
1471
|
+
"DOCKER_DEFAULT_PLATFORM",
|
|
1472
|
+
"DOCKER_CUSTOM_HEADERS",
|
|
1473
|
+
"DOCKER_CONTENT_TRUST",
|
|
1474
|
+
"DOCKER_CONTENT_TRUST_SERVER",
|
|
1475
|
+
"DOCKER_HIDE_LEGACY_COMMANDS",
|
|
1476
|
+
"BUILDKIT_PROGRESS",
|
|
1477
|
+
"GLIBC_TUNABLES",
|
|
1478
|
+
"GCONV_PATH",
|
|
1479
|
+
"BASH_ENV",
|
|
1480
|
+
"SHELLOPTS",
|
|
1481
|
+
"PS4",
|
|
1482
|
+
"PYTHONPATH",
|
|
1483
|
+
"PYTHONHOME",
|
|
1484
|
+
"PYTHONUSERBASE",
|
|
1485
|
+
"PYTHONPYCACHEPREFIX",
|
|
1486
|
+
"PYTHONPLATLIBDIR",
|
|
1487
|
+
"PYTHONWARNINGS",
|
|
1488
|
+
"BROWSER",
|
|
1489
|
+
"REQUESTS_CA_BUNDLE",
|
|
1490
|
+
"CURL_CA_BUNDLE",
|
|
1491
|
+
"HTTPLIB2_CA_CERTS",
|
|
1492
|
+
"SSLKEYLOGFILE",
|
|
1493
|
+
"GCE_METADATA_HOST",
|
|
1494
|
+
"GCE_METADATA_ROOT",
|
|
1495
|
+
"GCE_METADATA_IP",
|
|
1496
|
+
"NODE_OPTIONS",
|
|
1497
|
+
"NODE_PATH",
|
|
1498
|
+
"NODE_COMPILE_CACHE",
|
|
1499
|
+
"NODE_EXTRA_CA_CERTS",
|
|
1500
|
+
"NODE_TLS_REJECT_UNAUTHORIZED",
|
|
1501
|
+
"RUBYOPT",
|
|
1502
|
+
"RUBYLIB",
|
|
1503
|
+
"GEM_PATH",
|
|
1504
|
+
"GEM_HOME",
|
|
1505
|
+
"RUBYGEMS_GEMDEPS",
|
|
1506
|
+
"PERL5OPT",
|
|
1507
|
+
"PERL5LIB",
|
|
1508
|
+
"PERLLIB",
|
|
1509
|
+
"PERL5DB",
|
|
1510
|
+
"OPENSSL_CONF",
|
|
1511
|
+
"OPENSSL_MODULES",
|
|
1512
|
+
"OPENSSL_ENGINES",
|
|
1513
|
+
"SSH_AUTH_SOCK",
|
|
1514
|
+
"SSH_ASKPASS",
|
|
1515
|
+
"SSH_ASKPASS_REQUIRE",
|
|
1516
|
+
"SSH_SK_HELPER",
|
|
1517
|
+
"SSH_SK_PROVIDER",
|
|
1518
|
+
"SSH_PKCS11_HELPER",
|
|
1519
|
+
"SSH_AGENT_PID",
|
|
1520
|
+
"AWS_ENDPOINT_URL",
|
|
1521
|
+
"AWS_CA_BUNDLE",
|
|
1522
|
+
"AWS_PROFILE",
|
|
1523
|
+
"AWS_CONFIG_FILE",
|
|
1524
|
+
"AWS_SHARED_CREDENTIALS_FILE",
|
|
1525
|
+
"AWS_WEB_IDENTITY_TOKEN_FILE",
|
|
1526
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
1527
|
+
"AWS_ROLE_ARN",
|
|
1528
|
+
"AWS_EC2_METADATA_SERVICE_ENDPOINT",
|
|
1529
|
+
"AWS_ECR_CACHE_DIR",
|
|
1530
|
+
"CONTAINER_HOST",
|
|
1531
|
+
"CONTAINER_CONNECTION",
|
|
1532
|
+
"CONTAINER_SSHKEY",
|
|
1533
|
+
"PODMAN_CONNECTIONS_CONF",
|
|
1534
|
+
"CONTAINER_PROXY",
|
|
1535
|
+
"CONTAINERS_SSH_CONF",
|
|
1536
|
+
"CONTAINERS_CONF",
|
|
1537
|
+
"CONTAINERS_CONF_OVERRIDE",
|
|
1538
|
+
"CONTAINERS_REGISTRIES_CONF",
|
|
1539
|
+
"CONTAINERS_REGISTRIES_CONF_OVERRIDE",
|
|
1540
|
+
"REGISTRIES_CONFIG_PATH",
|
|
1541
|
+
"CONTAINERS_STORAGE_CONF",
|
|
1542
|
+
"CONTAINERS_STORAGE_CONF_OVERRIDE",
|
|
1543
|
+
"CONTAINERS_POLICY_JSON",
|
|
1544
|
+
"STORAGE_OPTS",
|
|
1545
|
+
"CONTAINERS_HELPER_BINARY_DIR",
|
|
1546
|
+
"REGISTRY_AUTH_FILE",
|
|
1547
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
1548
|
+
"NOTIFY_SOCKET",
|
|
1549
|
+
"XDG_CONFIG_HOME",
|
|
1550
|
+
"XDG_RUNTIME_DIR",
|
|
1551
|
+
"APPDATA",
|
|
1552
|
+
"PROGRAMDATA",
|
|
1553
|
+
"PROGRAMFILES",
|
|
1554
|
+
"LOCALAPPDATA",
|
|
1555
|
+
"SSH",
|
|
1556
|
+
"CONTAINERD_ADDRESS",
|
|
1557
|
+
"CONTAINERD_NAMESPACE",
|
|
1558
|
+
"NERDCTL_TOML",
|
|
1559
|
+
"CNI_PATH",
|
|
1560
|
+
"NETCONFPATH",
|
|
1561
|
+
"ROOTLESSKIT_STATE_DIR",
|
|
1562
|
+
"NERDCTL_LOG_FILE",
|
|
1563
|
+
"SSL_CERT_FILE",
|
|
1564
|
+
"SSL_CERT_DIR",
|
|
1565
|
+
"GODEBUG",
|
|
1566
|
+
"HTTP_PROXY",
|
|
1567
|
+
"HTTPS_PROXY",
|
|
1568
|
+
"NO_PROXY",
|
|
1569
|
+
"FTP_PROXY",
|
|
1570
|
+
"ALL_PROXY"
|
|
1571
|
+
]);
|
|
1572
|
+
const DOCKER_CLIENT_ENV_KEYS_UPPER = new Set([...DOCKER_CLIENT_ENV_KEYS].map((k) => k.toUpperCase()));
|
|
1573
|
+
/**
|
|
1574
|
+
* Env-var prefixes whose WHOLE family the docker client (or a helper it execs)
|
|
1575
|
+
* reads, so a NAMED list is always one release behind and a colliding secret in
|
|
1576
|
+
* ANY member is a hazard. `LD_*` / `DYLD_*` are the dynamic loader (code
|
|
1577
|
+
* injection, glibc + macOS); `AWS_ENDPOINT_URL_*` is the per-service endpoint
|
|
1578
|
+
* family aws-sdk-go-v2 (and so `docker-credential-ecr-login`) honours — a
|
|
1579
|
+
* secret named `AWS_ENDPOINT_URL_ECR` walks around the exact
|
|
1580
|
+
* `AWS_ENDPOINT_URL` entry and redirects a request signed with the operator's
|
|
1581
|
+
* real credentials (go-to-k/cdkd#2186 round 4). `CLOUDSDK_` is gcloud's (go-to-k/cdkd#3599): every
|
|
1582
|
+
* gcloud property is settable as `CLOUDSDK_<SECTION>_<NAME>`, which covers
|
|
1583
|
+
* its token host, API endpoint overrides, proxy, CA bundle and account, and
|
|
1584
|
+
* the `docker-credential-gcloud` wrapper execs `$CLOUDSDK_PYTHON
|
|
1585
|
+
* $CLOUDSDK_PYTHON_ARGS`. `BASH_FUNC_` is bash's exported-function family.
|
|
1586
|
+
* No plausible secret name collides with these, apart from the one listed in
|
|
1587
|
+
* {@link DOCKER_CLIENT_ENV_PREFIX_EXEMPTIONS}. Matched by prefix rather than
|
|
1588
|
+
* enumerated (issue go-to-k/cdkd#2183 review). `SSH_` was a prefix here and was demoted to
|
|
1589
|
+
* an EXACT enumeration in {@link DOCKER_CLIENT_ENV_KEYS} (go-to-k/cdkd#2186 review round
|
|
1590
|
+
* 3): the family is not
|
|
1591
|
+
* uniformly dangerous and is not growing, while the prefix broke realistic,
|
|
1592
|
+
* currently-working secrets (`SSH_PRIVATE_KEY`, GitLab CI's canonical
|
|
1593
|
+
* deploy-key spelling). Exported so the test fence can assert the EXACT
|
|
1594
|
+
* contents — a hardcoded copy in the test made the anti-shadowing fence
|
|
1595
|
+
* one-directional (go-to-k/cdkd#2186 round 4 finding 2).
|
|
1596
|
+
*/
|
|
1597
|
+
const DOCKER_CLIENT_ENV_PREFIXES = [
|
|
1598
|
+
"LD_",
|
|
1599
|
+
"DYLD_",
|
|
1600
|
+
"AWS_ENDPOINT_URL_",
|
|
1601
|
+
"CLOUDSDK_",
|
|
1602
|
+
"BASH_FUNC_"
|
|
1603
|
+
];
|
|
1604
|
+
/**
|
|
1605
|
+
* Exact names inside a {@link DOCKER_CLIENT_ENV_PREFIXES} family that are still
|
|
1606
|
+
* delivered. An entry must be a realistic secret name AND harmless to the
|
|
1607
|
+
* helper that reads it. `CLOUDSDK_AUTH_ACCESS_TOKEN` is gcloud's own variable
|
|
1608
|
+
* for a caller-supplied access token (go-to-k/cdkd#3599). Given to `docker-credential-gcloud`,
|
|
1609
|
+
* it only changes which token gcloud hands docker, with no network call of its
|
|
1610
|
+
* own. gcloud's `auth docker-helper` answers only for a registry in its own
|
|
1611
|
+
* supported list unless `artifacts/allow_unrecognized_registry` is set, and
|
|
1612
|
+
* that property, the token host, the universe domain and every other variable
|
|
1613
|
+
* that could redirect or weaken the exchange stay refused by the `CLOUDSDK_`
|
|
1614
|
+
* prefix. Stored upper-case and matched case-insensitively. Never exempt an
|
|
1615
|
+
* exact {@link DOCKER_CLIENT_ENV_KEYS} member: the exact list wins.
|
|
1616
|
+
*/
|
|
1617
|
+
const DOCKER_CLIENT_ENV_PREFIX_EXEMPTIONS = /* @__PURE__ */ new Set(["CLOUDSDK_AUTH_ACCESS_TOKEN"]);
|
|
1618
|
+
/**
|
|
1619
|
+
* Is `key` the name of a var the docker client reads? Case-INSENSITIVE, because
|
|
1620
|
+
* Windows environment lookups are, so a lowercase `docker_host` must be caught
|
|
1621
|
+
* too (issue go-to-k/cdkd#2183). Matches the exact denylist OR a prefixed family — the
|
|
1622
|
+
* prefix families are fail-closed on the whole prefix, so an unlisted `LD_*` /
|
|
1623
|
+
* `DYLD_*` / `AWS_ENDPOINT_URL_*` / `CLOUDSDK_*` / `BASH_FUNC_*` secret is
|
|
1624
|
+
* dropped (with a rename warning) rather than reaching the client, except for
|
|
1625
|
+
* a name in {@link DOCKER_CLIENT_ENV_PREFIX_EXEMPTIONS}.
|
|
1626
|
+
*/
|
|
1627
|
+
function isDockerClientEnvKey(key) {
|
|
1628
|
+
const upper = key.toUpperCase();
|
|
1629
|
+
if (DOCKER_CLIENT_ENV_KEYS_UPPER.has(upper)) return true;
|
|
1630
|
+
if (DOCKER_CLIENT_ENV_PREFIX_EXEMPTIONS.has(upper)) return false;
|
|
1631
|
+
return DOCKER_CLIENT_ENV_PREFIXES.some((prefix) => upper.startsWith(prefix));
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* A well-formed `docker run -e` variable NAME: non-empty, and containing
|
|
1635
|
+
* neither `=` (the OS parses the environ entry's name as everything before the
|
|
1636
|
+
* first one) nor NUL (Node refuses to spawn). A newline IS accepted, because it
|
|
1637
|
+
* is inside the class — not because of the anchor: JS `$` without the `m` flag
|
|
1638
|
+
* matches only at end of input (`/^abc$/.test('abc\n') === false`). That
|
|
1639
|
+
* matches the clause list this replaced, i.e. deliberately not stricter.
|
|
1640
|
+
*/
|
|
1641
|
+
const WELL_FORMED_ENV_KEY = /^[^=\u0000]+$/;
|
|
1642
|
+
/**
|
|
1643
|
+
* Is `key` a shape that cannot be a well-formed `docker run -e` variable NAME?
|
|
1644
|
+
* Defined POSITIVELY as {@link WELL_FORMED_ENV_KEY}'s complement (go-to-k/cdkd#2186 rounds
|
|
1645
|
+
* 5-6). Enumerating the bad spellings one at a time closed `=` in round 4 and
|
|
1646
|
+
* left the empty key (`-e ''` — docker rejects it with an opaque error naming
|
|
1647
|
+
* no secret) and a NUL-bearing key still open; the complement closes any
|
|
1648
|
+
* further bad shape without another clause. A sensitive key matching this
|
|
1649
|
+
* takes the same fail-closed
|
|
1650
|
+
* collision path as a docker-client-var name: no `-e` flag, no spawn-env entry,
|
|
1651
|
+
* reported in `collisions`. (This is the NAME only.)
|
|
1652
|
+
*/
|
|
1653
|
+
function isMalformedEnvKey(key) {
|
|
1654
|
+
return !WELL_FORMED_ENV_KEY.test(key);
|
|
1655
|
+
}
|
|
1426
1656
|
|
|
1427
1657
|
//#endregion
|
|
1428
|
-
export {
|
|
1429
|
-
//# sourceMappingURL=docker-cmd-
|
|
1658
|
+
export { stringifyThrown as C, resetEmbedConfig as D, getEmbedConfig as E, setEmbedConfig as O, sanitizeServiceExceptionMessage as S, resolveConfiguredLogLevel as T, clampErrorName as _, isDockerClientEnvKey as a, flattenToOneLine as b, runDockerStreaming as c, absoluteAssemblyPathEscape as d, assemblyPathEscape as f, resolveAssemblyPath as g, renderAssemblyPathEscape as h, getDockerCmd as i, spawnStreaming as l, namesTheSameDirectory as m, finchSecretArgvRefusal as n, isMalformedEnvKey as o, displayUntrustedValue as p, formatDockerLoginError as r, runDockerForeground as s, docker_cmd_exports as t, warnFinchArgvExposure as u, describeAwsFailureForWarn as v, getLogger as w, isAwsServiceException as x, describeCredentialLoadFailure as y };
|
|
1659
|
+
//# sourceMappingURL=docker-cmd-leyvDn1u.js.map
|