Skip to content

Test activation metadata quoting against shell breakouts - #79597

Merged
pelikhan merged 4 commits into
mainfrom
copilot/uk-ai-resilience-uk-ai-governance-triage-alerts-11
Nov 21, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/uk-ai-resilience-uk-ai-governance-triage-alerts-11

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Critical alerts flagged activation metadata embedded in single-quoted YAML and shell strings. Add regression coverage to verify quote-breaking payloads remain inert in both output paths.

  • Environment scalar: Compile adversarial metadata and verify the YAML value decodes back to the original payload.
  • Chunked printf: Execute generated commands and verify the payload is preserved without creating the injected marker file.

The regression uses a payload shaped like:

'; touch "$RUNNER_TEMP/metadata-escaped"; # ${{ github.event }}

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@gh-aw-bot gh-aw-bot changed the title [WIP] Add regression test for unsafe quoting alerts in compiler_yaml.go Test activation metadata quoting against shell breakouts Nov 20, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 20, 2026 23:10
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 23:10
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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 analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #79597 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #79597 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this change does: It adds regression coverage for quoted activation metadata in environment values and chunked output.

Should fix: The chunked-output test duplicates the existing test runner; a shared helper can keep the two cases in sync.

Verdict: fix the duplication.

Not checked: I did not run the shell-breakout regression.

Lean: -10 lines possible.

Generated by ✂️ Ponytail Reviewer for #79597 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again


runnerTemp := t.TempDir()
chunks := 0
for _, step := range document.Jobs["activation"].Steps {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The large-metadata test already runs these same chunks and reads the resulting file, so a change to the chunk format now requires two test runners to be updated; extract that shared setup into one test helper and keep the quote-specific assertions here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted chunk execution and payload reading into a shared helper used by both tests. Updated in 2516c950.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-9a29aee8-c3e7-4e88-9210-53c678a55a54","parents":[],"payload":{"id":"ldg-c3da8dcb-ee23-437f-804b-5661bc1d9d95","operation":"append","value":{"finding_count":0,"head_sha":"b2b570ce34c37eec6baca0626d2c93a77ba820b0","outcome":"aligned"}},"sha":"sha256:cc4c219c22a696de608574c6230c46f8d1cae78346843165f73d4c429912a3d7","timestamp":"2026-11-20T23:17:53.750Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No actionable issues found in the changed test coverage. The added cases exercise both environment and chunked-shell metadata paths and verify payload round-tripping and shell-breakout inertness. Static review only; tests were not run.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd — requesting changes because the new regression test fails as written.

Both subtests of TestCompilerActivationMarkdownMetadataQuoting fail at compile time. The payload contains ${{ github.event }}, which the expression allowlist rejects, so the test never reaches the metadata quoting path it is meant to cover.

📋 Key Themes & Highlights

Key Themes

  • Failing test: the payload uses a non-allowlisted expression. Replacing it with ${{ github.event.issue.title }} makes both subtests pass locally, which suggests the quoting logic is sound.
  • Verified scope: the diff touches only the test file, with no production changes.

Positive Highlights

  • ✅ Good coverage choice: exercises both the environment path and the chunked printf path.
  • ✅ The chunked test checks that the injected marker file is not created.
  • ✅ gofmt reports no formatting issues.

@copilot please address the review comment above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

}

func TestCompilerActivationMarkdownMetadataQuoting(t *testing.T) {
const attack = `'; touch "$RUNNER_TEMP/metadata-escaped"; # ${{ github.event }}`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The attack payload contains ${{ github.event }}, which the compile-time expression allowlist rejects. Both subtests fail in compileActivationMetadataWorkflow with Validation failed for field 'expressions' ... 1 unauthorized expressions found, so the metadata quoting code is never exercised.

💡 Suggested fix

Use an allowlisted expression such as ${{ github.event.issue.title }}. I checked this locally: with that substitution, TestCompilerActivationMarkdownMetadataQuoting/environment and /chunked_printf both pass, so the quoting logic itself holds.

If github.event must stay in the payload, the test should assert on the expected validation error instead of compiling successfully.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the fixture to workflow_call and the payload expression to ${{ inputs.model }}; the regression tests pass. Updated in 2516c950.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-543a2393-8b48-449c-8109-6b9d71e37c6e","parents":[],"payload":{"id":"ldg-9bf8af11-4d88-4cf1-82a7-4e7b5001d7c0","operation":"append","value":{"finding_count":0,"head_sha":"b2b570ce34c37eec6baca0626d2c93a77ba820b0","outcome":"no_findings"}},"sha":"sha256:f47d5f4173a2ae1dc11b041193084d245dd57317dad333a22513f9a22c5ba6c7","timestamp":"2026-11-20T23:20:26.066Z","type":"ledger_append","version":1}
History

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A disallowed fixture expression makes both metadata subtests fail before quoting checks, while the chunked subtest lacks an assertion against live GitHub Actions expressions.

2 open issues
What changed in this PR

This test-only PR adds regression coverage for activation metadata quoting in the gh-aw compiler, supporting the security-alert investigation in #79542.

Changes:

  • Adds an adversarial payload to check YAML environment-value escaping and JSON round-tripping.
  • Exercises generated chunked printf commands in Bash, checking payload preservation and absence of an injected marker file.
File Description
pkg/​workflow/​compiler_markdown_metadata_test.go Adds quoting regressions for environment scalars and chunked shell output.

Review effort: Max (adaptive)

Comment on lines +145 to +147
const attack = `'; touch "$RUNNER_TEMP/metadata-escaped"; # ${{ github.event }}`
workflow := func(model string) string {
return fmt.Sprintf("---\non: workflow_dispatch\nstrict: false\nengine: copilot\n---\n# Work\n\n## agent: reader\n---\nmodel: %q\ntools: [Read]\n---\nRead files.\n## end agent: reader\n", model)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the fixture to workflow_call with ${{ inputs.model }}. Updated in 2516c950.

if !strings.HasPrefix(step.Run, "printf '%s' '") {
break
}
command := exec.Command("bash", "-e", "-c", step.Run)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared chunk runner now asserts each generated step.Run contains no ${{ before executing it. Updated in 2516c950.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/compiler_markdown_metadata_test.go:172): address unresolved feedback - Review comment
  3. Review (pkg/workflow/compiler_markdown_metadata_test.go:145): address unresolved feedback - Review comment
  4. Review (pkg/workflow/compiler_markdown_metadata_test.go:147): address unresolved feedback - Review comment
  5. Review (pkg/workflow/compiler_markdown_metadata_test.go:176): address unresolved feedback - Review comment
  6. Fix failing check Unit tests (C) (FAILURE): Check run.
  7. Fix failing check Unit tests (C) (FAILURE): Check run.
  8. Fix failing check Unit tests (K-M) (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "b2b570ce34c37eec6baca0626d2c93a77ba820b0",
  "kind": "requested",
  "schema_version": "1",
  "state": "eb646deee85cb1c7fae8669fd54873bf24c6db8307a783b58ddefcfc87f6fd49",
  "work": [
    "0384d253d3410c71a864e41868d2b53514a0546251850d41a7465f9d24f0c2f9",
    "070b5fed6c77e6f99af8aa0864293d562a676d9316dad5428bdc04c242733226",
    "5abca6a1cf798ab7cad7c5526b0c8f36fe66cca179cd1e8a0e551988700e5e12",
    "5c976ed5a8dfb0029ad82b40ab3223f84638189dfcdb12264abc0a585a15506f",
    "9389f29e4128b51c2b94d5955c74200424bda5cc40389ba434363a9ab39500c1",
    "aca3b7bb36949497f61b0af4562879b10bc58cf763a2203a43a2b65d905aff42"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 2 commits November 20, 2026 23:45
…nce-uk-ai-governance-triage-alerts-11

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged latest main (ff67f633) and addressed the linked review feedback in 2516c950. Focused metadata tests and the final repository validation passed; the K–M test failure also passes when rerun locally.

@pelikhan
pelikhan merged commit a2e58db into main Nov 21, 2026
92 checks passed
@pelikhan
pelikhan deleted the copilot/uk-ai-resilience-uk-ai-governance-triage-alerts-11 branch November 21, 2026 00:36
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.

[uk-ai-resilience] [uk-ai-governance] Tier B: triage critical go/unsafe-quoting alerts 1132/1133 in compiler_yaml.go

4 participants