Repository navigation
Quote prompt-step environment values as YAML scalars - #74560
Conversation
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
🟡 Changes recommended
The quoting change breaks the existing PR-context test assertion and double-quotes deferred prompt values, producing incorrect environment contents and failing deferred-prompt assertions.
2 open issues
What changed in this PR
This PR hardens prompt-step environment emission in the gh-aw compiler against YAML-significant expression content, addressing issue #73221.
Changes:
- Uses
writeYAMLEnvto quote and escape environment values. - Adds a YAML round-trip regression test for expressions containing colons, quotes, and comment markers.
| File | Description |
|---|---|
pkg/workflow/unified_prompt_step.go |
Emits prompt-step environment values through the YAML quoting helper. |
pkg/workflow/unified_prompt_creation_test.go |
Checks that YAML-significant expression content survives serialization unchanged. |
Review effort: Balanced (auto)
| envKeys := sliceutil.SortedKeys(allEnvVars) | ||
| for _, key := range envKeys { | ||
| yaml.WriteString(" " + key + ": " + allEnvVars[key] + "\n") | ||
| writeYAMLEnv(yaml, " ", key, allEnvVars[key]) |
| envKeys := sliceutil.SortedKeys(allEnvVars) | ||
| for _, key := range envKeys { | ||
| yaml.WriteString(" " + key + ": " + allEnvVars[key] + "\n") | ||
| writeYAMLEnv(yaml, " ", key, allEnvVars[key]) |
There was a problem hiding this comment.
Review complete: no actionable issues found in the changed lines. The environment emission now uses YAML-safe quoting, and the regression test verifies round-trip preservation of expression values. The specialist pass was unavailable because its pre-fetched diff reads were denied; independent review completed.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
🧪 Test Quality Sentinel ReportSummary✅ Score: 100/100 — Excellent Implementation Ratio: 0% (no implementation tests detected) Test Coverage AnalysisNew Test Found: 1
Test Details
TestGenerateUnifiedPromptCreationStep_QuotesExpressionEnvVarsDesign: Round-trip test for YAML-significant characters in environment expressions. Expression tested: Includes: Single quotes, double quotes, colon-space (YAML metacharacter), comment syntax Assertions:
Edge Cases Covered:
Quality Signals:
Violations Check✅ No Go mock libraries detected Recommendation✅ APPROVE — This test directly addresses the security boundary fix (YAML injection prevention). The single, focused regression test has excellent coverage of the vulnerability scenario with proper edge cases. No concerns detected.
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 100/100. 0% implementation tests (threshold: 30%). Single focused regression test with comprehensive edge-case coverage of YAML injection prevention. No violations.
🧪 Test quality analysis by Test Quality Sentinel · copilot · haiku45 · ~43 AIC · ⌖ ~12 AIC · ⊞ 9.4K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The escaping direction is right, but the change breaks three existing tests, so requesting changes.
📋 Key Themes & Highlights
Key Themes
- Double quoting of literal env values:
ExpressionMapping.environmentValue()already%q-quotes literal mappings, andwriteYAMLEnvquotes them again. This breaksTestDeferredPromptCompilation, which expects bare__GH_AW_DEFERRED_...__placeholders. Fix in the inline comment onunified_prompt_step.go:475. - Stale assertion:
TestGenerateUnifiedPromptCreationStep_PRContextConditional(unified_prompt_creation_test.go:745) asserts the old unquotedGH_AW_INCLUDE_PR_CONTEXT: ${{form. It should check the quoted scalar instead. - Sibling still unescaped:
generateInterpolationAndTemplateStepintemplate.go:145still writesmapping.EnvVar + ": " + mapping.environmentValue()by concatenation. OnceenvironmentValue()is fixed, this site needswriteYAMLEnvtoo, or it will emit invalid YAML.
Positive Highlights
- ✅ The round-trip test is a good fit: the raw form of its expression is invalid YAML (checked with PyYAML), so the test would catch the original bug.
- ✅ Using the existing
writeYAMLEnvhelper keeps one escaping path.
Notes
TestCredentialFreePromptEnvironmentfails in this sandbox on an inheritedGITHUB_TOKENguard. It is unrelated to this diff.- I could not run the parent commit as a baseline (remote fetch blocked), so pre-existing failures are not ruled out. I checked the three failures against the diff and a temporary local experiment, which I reverted.
@copilot please address the review comments above, then rerun go test ./pkg/workflow/.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
| envKeys := sliceutil.SortedKeys(allEnvVars) | ||
| for _, key := range envKeys { | ||
| yaml.WriteString(" " + key + ": " + allEnvVars[key] + "\n") | ||
| writeYAMLEnv(yaml, " ", key, allEnvVars[key]) |
There was a problem hiding this comment.
[/diagnosing-bugs] Root cause is a second quoting layer, and it breaks the deferred-prompt placeholders. For literal mappings, ExpressionMapping.environmentValue() (expression_extraction.go:29) already returns a Go %q-quoted string, and writeYAMLEnv quotes it again. As a result TestDeferredPromptCompilation sees the placeholder wrapped in extra quote characters instead of the bare __GH_AW_DEFERRED_...__ value.
💡 Suggested fix
Keep one quoting layer. Make environmentValue() return the raw Content for literal mappings, keep the ${{ ... }} wrapping for expressions, and switch the template.go:145 call site to writeYAMLEnv too. Then writeYAMLEnv is the only place these values are quoted.
I checked this locally: with literal values left unquoted, both deferred-prompt tests pass. That local change was reverted and is not part of this review.
@copilot please address this.
| } | ||
| } | ||
|
|
||
| func TestGenerateUnifiedPromptCreationStep_QuotesExpressionEnvVars(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] Good regression test. The unquoted form of this expression is not valid YAML (checked with PyYAML), so the test would catch the bug.
💡 Suggested edge case
The fix also depends on %q escaping control characters. Consider one more table entry whose value spans two lines and starts with a double quote, so that path is covered too.
@copilot please address this.
|
@copilot run pr-finisher skill |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Ran PR-finisher and pushed 32282ef: fixed double-quoted literals, hardened interpolation emission, and updated regression tests. Focused tests, formatting, repository lint, and secret scanning pass. Not yet merge-ready: the full package reproduces the unrelated A maintainer must resolve the remaining blockers and re-trigger CI; CI on the new HEAD is unverified. No merge performed. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot review the double encoding and ensure it makes sense. Add tests. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added a parsed-YAML regression test for a literal containing a colon, quote, newline, and backslash. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |


Generated prompt-step environment values were concatenated into YAML without escaping, allowing YAML-significant expression content to alter or invalidate the generated workflow.
writeYAMLEnvto quote and escape each value.