Skip to content

[P0] .env writer emits unquoted values — special characters corrupt generated .env #81

Description

@Bccorb

Severity: P0 — Bug

Where: src/core/env.ts:40-46 (writeEnv, used by applyTemplateEnv and wireApiEnv)

Problem
Values are written as bare ${k}=${v}. A managed API_SERVICE_TOKEN, or a user-pasted OAuth secret, containing #, whitespace, or a newline produces a .env that dotenv mis-parses (truncated at #/space). Inconsistent with src/generators/docker/docker.ts:writeEnvFile, which at least quotes multiline values.

Suggested fix
Quote/escape values consistently (single source of truth for env writing). Add tests for values containing #, spaces, quotes, and newlines.

Filed from an internal code audit (2026-07). File references are against main at audit time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliSeamless CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions