Skip to content

Commit 8c8210e

Browse files
authored
fix(sdk): stop injecting ECLOUD_PLATFORM_HOST into publicEnv (#151)
## Summary Companion to ecloud-platform [#154](Layr-Labs/ecloud-platform#154), which removes the bulk \`spec.Env\` → \`tee-env-*\` propagation in favor of the platform setting \`tee-env-ECLOUD_PLATFORM_HOST\` directly from \`cfg.DeriveAppHostname(appAddress)\`. With that landing, the CLI's client-side injection of the same value into \`publicEnv\` becomes redundant *and* harmful: it puts a platform-derived value into the user's on-chain release blob, where it shows up in \`ecloud compute app info\`, the verify dashboard, and any consumer that reads \`Release.publicEnv\`. Worse, releases cut against an environment whose \`AppBaseDomain\` later changes carry a stale hostname forever. ## Change ```diff - // 4a. Inject the platform-routed hostname as a public env var so - // the VM entrypoint's setup_tls knows which hostname to obtain a - // cert for. Platform routing expects every app to answer on - // <addr>.<platformEnv>.<appBaseDomain>, so this replaces the - // compute-tee model where the user supplied DOMAIN manually. The - // user's DOMAIN env var (if any) is carried separately in the env - // file and is additive: setup_tls issues a cert for both. - const platformHost = derivePlatformHost(environmentConfig, options.appId); - if (platformHost !== "") { - publicEnv["ECLOUD_PLATFORM_HOST"] = platformHost; - logger.info(`Platform hostname: ${platformHost}`); - } + // ECLOUD_PLATFORM_HOST is intentionally NOT injected into publicEnv. + // The platform sets it directly as tee-env-* metadata at VM-create + // time (see ecloud-platform pkg/services/infraService/providers/gcp/ + // compute.go). Platform-derived values belong in platform metadata. ``` \`derivePlatformHost\` itself stays exported in \`config/environment.ts\` — external consumers (e.g. \`scripts/e2e/lib/cli.sh\` in ecloud-platform's e2e harness) use it for client-side prediction when they need to know the platform-routed hostname before calling \`/info\`. ## Test plan - [x] \`pnpm tsc --noEmit\` — clean. - [x] \`pnpm vitest run\` — 35 pass (no behavior change for any test that doesn't introspect publicEnv contents). - [ ] After ecloud-platform #154 merges and a new CLI tag (1.0.0-devep5) ships, re-run \`scripts/e2e/scenarios/02_platform_deploy_then_platform_upgrade.sh\` against sepolia-dev. ## Compatibility This PR is **safe to land before ecloud-platform #154 is deployed**: - Old CLIs (\`<= 1.0.0-devep4\`) continue to inject \`ECLOUD_PLATFORM_HOST\` into publicEnv. The platform reads it from \`spec.Env\` and propagates as \`tee-env-*\`. Works as before. - New CLI (this PR) doesn't inject. Platform pre-#154 reads no \`ECLOUD_PLATFORM_HOST\` from \`spec.Env\`, doesn't emit \`tee-env-ECLOUD_PLATFORM_HOST\`, VM's setup_tls falls back to its localhost default and Caddy serves on the user's \`DOMAIN\` only. **No platform routing until #154 lands** — the user app still gets a cert for any custom \`DOMAIN\` they set. - Once #154 ships, both CLIs work: the new CLI relies on platform-set metadata; the old CLI's injected publicEnv \`ECLOUD_PLATFORM_HOST\` is harmless because the platform's loop is gone. ## Companion PR - ecloud-platform [#154](Layr-Labs/ecloud-platform#154) — drops the spec.Env → tee-env-* loop and explicitly emits the platform hostname.
2 parents d34097b + 9b213e7 commit 8c8210e

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

packages/sdk/src/client/common/release/prepare.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { getImageDigestAndName } from "../registry/digest";
1111
import { encryptRSAOAEPAndAES256GCM, getAppProtectedHeaders } from "../encryption/kms"; // getAppProtectedHeaders
1212
import { getKMSKeysForEnvironment } from "../utils/keys";
1313
import { REGISTRY_PROPAGATION_WAIT_SECONDS } from "../constants";
14-
import { derivePlatformHost } from "../config/environment";
1514

1615
import { parseAndValidateEnvFile } from "../env/parser";
1716

@@ -151,18 +150,19 @@ export async function prepareRelease(
151150
publicEnv["EIGEN_MACHINE_TYPE_PUBLIC"] = instanceType;
152151
logger.info(`Instance type: ${instanceType}`);
153152

154-
// 4a. Inject the platform-routed hostname as a public env var so
155-
// the VM entrypoint's setup_tls knows which hostname to obtain a
156-
// cert for. Platform routing expects every app to answer on
157-
// <addr>.<platformEnv>.<appBaseDomain>, so this replaces the
158-
// compute-tee model where the user supplied DOMAIN manually. The
159-
// user's DOMAIN env var (if any) is carried separately in the env
160-
// file and is additive: setup_tls issues a cert for both.
161-
const platformHost = derivePlatformHost(environmentConfig, options.appId);
162-
if (platformHost !== "") {
163-
publicEnv["ECLOUD_PLATFORM_HOST"] = platformHost;
164-
logger.info(`Platform hostname: ${platformHost}`);
165-
}
153+
// ECLOUD_PLATFORM_HOST is intentionally NOT injected into publicEnv.
154+
// The platform sets it directly as tee-env-* metadata at VM-create
155+
// time (see ecloud-platform pkg/services/infraService/providers/gcp/
156+
// compute.go) from cfg.DeriveAppHostname(appAddress). Putting it
157+
// here too would mean the user's on-chain release blob carries a
158+
// value the user never supplied, which has two costs:
159+
// 1. The hostname appears in the public env list rendered by
160+
// `ecloud compute app info` and the verify dashboard, where
161+
// it's noise to anyone reading the release.
162+
// 2. Releases cut against an environment whose AppBaseDomain
163+
// later changes would carry a stale hostname forever.
164+
// Platform-derived values belong in platform metadata, not in the
165+
// user's release.
166166

167167
// 5. Encrypt private environment variables
168168
logger.info("Encrypting environment variables...");

0 commit comments

Comments
 (0)