Skip to content

Environment variables exposed to CEL expressions via buildEnvContext() #323

@umag

Description

@umag

Description

buildEnvContext() in src/domain/expressions/model_resolver.ts (line 32-34) exposes ALL environment variables to CEL expressions via Deno.env.toObject(). Any definition using ${{ env.AWS_SECRET_ACCESS_KEY }} or similar will have the secret value resolved and persisted as plaintext YAML in .swamp/definitions-evaluated/.

Steps to Reproduce

  1. Set sensitive environment variables (e.g., AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN)
  2. Create a model definition using ${{ env.AWS_SECRET_ACCESS_KEY }} in globalArguments
  3. Run any command that evaluates expressions
  4. Inspect .swamp/definitions-evaluated/ — secrets are in plaintext YAML

Expected Behavior

Either restrict which env vars are accessible to CEL expressions (allowlist), or ensure evaluated definitions with secrets are never persisted to disk.

Actual Behavior

All env vars from the process environment are exposed and persisted as plaintext after expression evaluation.

Summary

This affects the expression resolver in model_resolver.ts. The fix would involve either restricting env var access via an allowlist pattern, or ensuring that evaluated definitions containing env references are marked as sensitive and excluded from disk persistence.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions