Skip to content

fix(generate): env-route promote input JSON and escape dispatch-input defaults#604

Merged
joshua-temple merged 1 commit into
mainfrom
fix/promote-input-json-quoting
Jul 16, 2026
Merged

fix(generate): env-route promote input JSON and escape dispatch-input defaults#604
joshua-temple merged 1 commit into
mainfrom
fix/promote-input-json-quoting

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

The promote Build Deploy Matrices step embedded operator-input JSON in a shell single-quote literal (DEFAULT_INPUTS='{...}'), and json.Marshal never escapes an apostrophe. A benign manifest value like message: "it's live" made cascade generate-workflow exit 0 but emit a script that fails shell parsing (bash -n: unexpected EOF) - breaking every promotion; a crafted value could execute in the promote job. The dispatch-input default sink (generator.go:779) had the same apostrophe-breaks-YAML flaw.

Fix: route the input JSON out of the shell literal into per-deploy env: entries (read back double-quoted, fed only to jq as data), and emit both those env values and the dispatch-input defaults via a yamlSingleQuote helper (single-quote, apostrophes doubled). No behavioral change for special-char-free inputs; own workflows regenerate byte-identical.

Verification: build/-race/lint green, 3005 tests; red-then-green tests (bash -n rc2->0, yaml.Unmarshal err->parses) + e2e scenario 66-input-value-quoting. (Rebased onto main after the artifacts PR; CHANGELOG union, scenario renumbered 65->66.)

… defaults

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
(cherry picked from commit 87022d69f2f111ab05f6d3ea65ad7a6b5dcc889a)
@joshua-temple joshua-temple merged commit 321ab3e into main Jul 16, 2026
21 checks passed
@joshua-temple joshua-temple deleted the fix/promote-input-json-quoting branch July 16, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant