#6996·sst

sst diff can expose process environment through SSR site builders

Author: jsveCreated Sep 9, 2026Updated Sep 9, 2026

Summary

SSR site components copy the complete SST/Pulumi process environment into the environment input of their generated command:local:Command builder.

That process environment includes SST's active AWS session variables:

  • SST_AWS_ACCESS_KEY_ID
  • SST_AWS_SECRET_ACCESS_KEY
  • SST_AWS_SESSION_TOKEN

Because environment is an ordinary, non-secret Pulumi input, sst diff can render these values in plaintext when the builder appears in a detailed preview. Other ambient environment variables and CI secrets may be exposed as well.

Reproduction

Using a disposable AWS role/account:

  1. Create and deploy a minimal sst.aws.Astro or sst.aws.Nextjs site.
  2. Authenticate SST using temporary AWS session credentials.
  3. Run sst diff against the deployed stage.
  4. Inspect the generated <name>Builder command:local:Command resource.
  5. Its environment properties may contain plaintext SST_AWS_* values.

Any reproduction output should be fully redacted.

Affected components

The shared builder path appears to affect these AWS SSR components:

  • Analog
  • Astro
  • Nextjs
  • Nuxt
  • React
  • Remix
  • SolidStart
  • SvelteKit
  • TanStackStart

It also appears to affect Cloudflare Astro, ReactRouter, TanStackStart, and experimental x.SolidStart.

StaticSite uses a separate builder and does not appear to copy the complete ambient process environment.

Relevant source

AWS provider environment creation:

https://github.com/sst/sst/blob/v4.17.1/pkg/project/provider/aws.go#L43-L56

Environment passed to the Pulumi process:

https://github.com/sst/sst/blob/v4.17.1/pkg/project/project.go#L369-L394

https://github.com/sst/sst/blob/v4.17.1/pkg/project/run.go#L248-L251

SSR builder copies process.env:

https://github.com/sst/sst/blob/v4.17.1/platform/src/components/base/base-ssr-site.ts#L96-L116

Builder is registered as a stateful local command:

https://github.com/sst/sst/blob/v4.17.1/platform/src/components/aws/helpers/site-builder.ts#L9-L31

History

Whole-process environment added to SSR builds:

https://github.com/sst/sst/commit/168b1c1f804a7aaaeef941551637cd37fbfefc41

Site builds moved to command:local:Command:

https://github.com/sst/sst/commit/20bdd5e67a7699304743ab32c2f79132b15f2d2b

Expected behavior

Internal provider credentials and unrelated ambient variables should not become ordinary Pulumi resource inputs, appear in previews, or be stored unencrypted in state.

Suggested fix

Avoid spreading process.env into local.Command.environment.

The command provider already inherits the operating-system environment and overlays explicitly supplied values. SST should therefore only pass values that need to be explicit inputs: SST, user build environment, link environment, and component-specific build environment.

Credential-bearing inputs that must remain explicit should additionally be wrapped as Pulumi secrets.