CAST_AGE_KEY_FILE_<ENV> is unsettable for env names containing a hyphen #102

Closed
opened 2026-07-19 12:09:51 +00:00 by dan-claude-bot · 0 comments
dan-claude-bot commented 2026-07-19 12:09:51 +00:00 (Migrated from github.com)

Found by the 2026-07-19 release drill (two live Coolify 4.1.2 instances, cast 0.1.0 installed from a rehearsal release asset).

What happened

With an environment named drill-b, the attended-key path is advertised as:

no age key for drill-b: set CAST_AGE_KEY_FILE_DRILL-B (attended apply) or place a standing key at ~/.config/cast/age-drill-b.key

CAST_AGE_KEY_FILE_DRILL-B contains a hyphen — no POSIX shell can set that variable. src/secrets.ts:82 derives it as:

const injected = process.env[`CAST_AGE_KEY_FILE_${envName.toUpperCase()}`];

envName.toUpperCase() alone, no character mapping. Setting the natural guess CAST_AGE_KEY_FILE_DRILL_B (underscore) is not recognized. The standing-key fallback works (that's how the drill proceeded), but the per-invocation channel — the one the error message leads with, and the one that supports process substitution for never-on-disk keys — is unreachable for any hyphenated environment name.

Environment names are operator-chosen and hyphens are common (drill-b, us-east, pre-prod).

Suggested fix

Map the env name to a settable variable name, e.g. envName.toUpperCase().replace(/[^A-Z0-9]/g, "_"), accept it in the lookup, and print the mapped name in the refusal. (Worth a test with a hyphenated env name — the existing suite only uses single-word envs.)

🤖 Filed from the release-drill session.

Found by the 2026-07-19 release drill (two live Coolify 4.1.2 instances, cast 0.1.0 installed from a rehearsal release asset). ## What happened With an environment named `drill-b`, the attended-key path is advertised as: ``` no age key for drill-b: set CAST_AGE_KEY_FILE_DRILL-B (attended apply) or place a standing key at ~/.config/cast/age-drill-b.key ``` `CAST_AGE_KEY_FILE_DRILL-B` contains a hyphen — **no POSIX shell can set that variable**. `src/secrets.ts:82` derives it as: ```ts const injected = process.env[`CAST_AGE_KEY_FILE_${envName.toUpperCase()}`]; ``` `envName.toUpperCase()` alone, no character mapping. Setting the natural guess `CAST_AGE_KEY_FILE_DRILL_B` (underscore) is not recognized. The standing-key fallback works (that's how the drill proceeded), but the per-invocation channel — the one the error message leads with, and the one that supports process substitution for never-on-disk keys — is unreachable for any hyphenated environment name. Environment names are operator-chosen and hyphens are common (`drill-b`, `us-east`, `pre-prod`). ## Suggested fix Map the env name to a settable variable name, e.g. `envName.toUpperCase().replace(/[^A-Z0-9]/g, "_")`, accept it in the lookup, and print the mapped name in the refusal. (Worth a test with a hyphenated env name — the existing suite only uses single-word envs.) 🤖 Filed from the release-drill session.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: heavy-duty/cast#102
No description provided.