Skip to content

[static-analysis] RGS-018: Suspicious Payload Execution Pattern in smoke-issues.lock.yml - #77673

Merged
pelikhan merged 12 commits into
mainfrom
static-analysis/rgs-018-connector-defaults-literal-be9b45ad4c4c20ac
Nov 15, 2026
Merged

pelikhan merged 12 commits into
mainfrom
static-analysis/rgs-018-connector-defaults-literal-be9b45ad4c4c20ac

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Changes to workflow YAML files were excluded from this changeset to avoid GitHub token workflow-write restrictions. Run gh aw compile again on this branch and commit the regenerated .lock.yml files using credentials permitted to update GitHub Actions workflows before merging.

🚨 Runner-Guard Security Finding

Rule: RGS-018 — Suspicious Payload Execution Pattern
Severity: High
File: .github/workflows/smoke-issues.lock.yml
Line: 2818 (Configure Safe Output Scripts step)

Description

Runner-guard flags the generated Jira/Linear connector safe-output scripts because they contain JSON.parse(Buffer.from("e30=", base64).toString(utf8)) next to a spawnSync call, which matches its decode-and-execute heuristic.

Assessment

False positive. The base64 value is compiler-generated trusted connector content defaults ({} here, footer/body_footer otherwise), not a payload, and nothing decoded is executed. The base64 round-trip was unnecessary and trips the scanner.

Remediation (implemented)

pkg/workflow/compiler_connectors.go now emits the defaults as a JSON object literal, const connectorContentDefaults = {...};. json.Marshal escapes <, >, &, U+2028 and U+2029, so the literal is safe to embed as JS. The base64 decode chain is removed from generated scripts. The unit test was updated to assert the literal and the absence of Buffer.from(.

Validation

  • go build ./pkg/workflow/, go vet ./pkg/workflow/ and gofmt: clean
  • go test ./pkg/workflow/ -run TestConnector -count=1: PASS (includes the node-based generated-factory tests)
  • gh aw compile smoke-issues: succeeds; regenerated lock has no base64 occurrences
  • make agent-report-progress: the impacted-test and custom-linter steps ran, but the Go lint step failed because golangci-lint is not installed in this sandbox. It was not run.
  • Runner-guard itself is not runnable in this sandbox, so the finding disappearing is not confirmed locally. It should clear on the next scheduled scan.

Note: .lock.yml changes are stripped from delivery; a maintainer must run gh aw compile and commit the regenerated locks (smoke-issues.lock.yml).


Detected by runner-guard v2.6.0 — CI/CD source-to-sink vulnerability scanner
Workflow run: https://github.com/github/gh-aw/actions/runs/43557736817

🤖 Generated with [Claude Code]((claude.com/redacted)

Generated by 📊 Static Analysis Report · claude · routed: sonnet55 high · ~102 AIC · ⌖ ~2 AIC · ⊞ 10.5K · ◷

  • expires on Nov 20, 2026, 9:36 PM UTC-08:00

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot recompile

@pelikhan
pelikhan marked this pull request as ready for review November 14, 2026 05:50
Copilot AI adaptive review requested due to automatic review settings November 14, 2026 05:50
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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 #77673 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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 · ◇ ~1 AIC · ⊞ 7.3K · ◷

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

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.

Generated by Ponytail Reviewer for #77673 · codex · routed: gpt61 medium · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 182 · ◷

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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: 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.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 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 · ~5 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-14T05:53:51Z
review_event: REQUEST_CHANGES
top_themes:
  - expression interpolation risk when embedding connector footer JSON in Actions run blocks
files_reviewed:
  - pkg/workflow/compiler_connectors.go
  - pkg/workflow/connector_content_host_test.go
comment_count: 1
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Found one blocking issue: the new raw JSON literal is embedded inside a GitHub Actions run block, so expression-like footer text can be evaluated by Actions before the heredoc writes the script. Please keep this data expression-inert and add regression coverage. The generated lock-file concern is outside the changed files and was not included as an inline finding.

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

// json.Marshal escapes <, >, &, U+2028 and U+2029, so the literal is
// safe to embed. Avoid base64 decode chains, which static scanners
// (runner-guard RGS-018) flag as obfuscated payload execution.
data.SafeOutputs.Scripts[name].Script = "const connectorContentDefaults = " + string(encodedConfig) + ";\n" +

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This removes the base64 protection while still embedding body_footer/footer directly into the run: | heredoc generated by buildCustomScriptFilesStep. GitHub Actions evaluates ${{ ... }} expressions in run blocks before the shell runs, and json.Marshal does not escape that sequence. A configured footer such as ${{ secrets.X }} can therefore be expanded and written into the generated handler source (and potentially leak the secret). Please preserve an expression-inert transport (for example, pass the JSON through an environment variable or otherwise encode/escape ${{ before placing it in the run block), and add a regression test for expression-like footer text.

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

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-36599ad9-b75c-4848-812c-899b6b925038","parents":[],"payload":{"id":"ldg-5e7e1435-fc98-44d5-a3f8-e86e2390ad22","operation":"append","value":{"finding_count":1,"head_sha":"9aab01704e3b09bdaaa4099baff586fd7d82631e","outcome":"findings"}},"sha":"sha256:fe3978814219bb3225e53d2d65b50ea9636866cf6c3d3dbf1e9d9e34922cee2a","timestamp":"2026-11-14T05:57:58.686Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-316b70fa-3c29-49ec-a84e-c8f28f613e44","parents":[],"payload":{"id":"ldg-98c43f86-5d2c-4e9f-b1e0-aa6e5bb199a9","operation":"append","value":{"finding_count":0,"head_sha":"9aab01704e3b09bdaaa4099baff586fd7d82631e","outcome":"aligned"}},"sha":"sha256:c416b0b0435b9699056c7b853db2a2783563683578ecaf9dd2f1a2e3d8ee4349","timestamp":"2026-11-14T05:58:59.146Z","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

Unescaped Actions expressions in body-footer can cause compilation failures or interpolate unsafe values into generated JavaScript, potentially breaking the handler or injecting code.

1 open issue
What changed in this PR

Updates gh-aw’s connector safe-output script generation to avoid runner-guard’s base64 decode-and-execute heuristic.

Changes:

  • Emits connector content defaults directly as a JSON object literal instead of decoding base64.
  • Updates the compiler test to expect the literal and reject Buffer.from(.

Generated workflow locks are excluded from this PR and still need regeneration before merge.

File Description
pkg/​workflow/​connector_content_host_test.go Updates assertions for the generated defaults literal.
pkg/​workflow/​compiler_connectors.go Replaces base64 decoding with direct JSON emission.

Review effort: Max (dynamic)

Comment on lines +168 to +172
// Emit the trusted defaults as a JSON object literal (a JS expression).
// json.Marshal escapes <, >, &, U+2028 and U+2029, so the literal is
// safe to embed. Avoid base64 decode chains, which static scanners
// (runner-guard RGS-018) flag as obfuscated payload execution.
data.SafeOutputs.Scripts[name].Script = "const connectorContentDefaults = " + string(encodedConfig) + ";\n" +

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd. Requesting changes: the base64 removal is right, but the new raw JS literal lets GitHub Actions expand ${{ ... }} in body-footer.

📋 Key Themes and Highlights

Key Themes

  • Expression regression (blocking): json.Marshal escapes <, >, &, U+2028 and U+2029, but not $. A body-footer containing ${{ github.repository }} is written verbatim into the Configure Safe Output Scripts run: block, where Actions evaluates it. The base64 wrapper previously hid it. A scratch compile confirmed the raw ${{ in the emitted script.
  • Missing regression test: the updated test checks only that Buffer.from( is absent. It does not cover expression-like footer text.
  • Lock file not regenerated: the PR body says .lock.yml changes were stripped. smoke-issues.lock.yml still contains Buffer.from, so the runner-guard finding will persist until the lock is recompiled and committed.

Positive Highlights

  • ✅ Correct root-cause fix: the decode-and-execute chain is gone, not just reworded.
  • ✅ Escaping of <, >, & and U+2028/U+2029 is handled by json.Marshal, which prevents </script>-style breakage.
  • ✅ Small, surgical diff with the test updated in the same change.
🔧 Suggested fix

Escape $ in the JSON before embedding it, as \u0024. The JS value is unchanged, and no ${{ reaches the YAML. Add a test that asserts ${{ is absent from the compiled script.

@copilot please address the review comments above.

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

// json.Marshal escapes <, >, &, U+2028 and U+2029, so the literal is
// safe to embed. Avoid base64 decode chains, which static scanners
// (runner-guard RGS-018) flag as obfuscated payload execution.
data.SafeOutputs.Scripts[name].Script = "const connectorContentDefaults = " + string(encodedConfig) + ";\n" +

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/diagnosing-bugs] The root cause is fixed, but this introduces a regression. json.Marshal does not escape $, so a connector body-footer containing ${{ ... }} is now written verbatim into the run: block, where GitHub Actions expands it. The base64 wrapper previously kept it opaque. I confirmed the raw ${{ with a scratch compile.

💡 Suggested fix
footerLiteral := strings.ReplaceAll(string(encodedConfig), "$", `\u0024`)

$ only appears inside JSON strings, so replacing it keeps the JSON valid. In JS, \u0024 decodes to $: "Policy \u0024{{ github.repository }}" evaluates to Policy ${{ github.repository }}. I checked this with Node. The fix is not applied to the branch.

@copilot please address this.

encoded := base64.StdEncoding.EncodeToString([]byte(`{"body_footer":"Trusted policy for {workflow_name}","footer":false}`))
require.Contains(t, script, fmt.Sprintf("const connectorContentDefaults = JSON.parse(Buffer.from(%q, 'base64').toString('utf8'));", encoded))
require.Contains(t, script, `const connectorContentDefaults = {"body_footer":"Trusted policy for {workflow_name}","footer":false};`)
require.NotContains(t, script, "Buffer.from(")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/tdd] No regression test covers the escaping gap above. This test only checks that base64 is gone. Add a case whose body-footer contains ${{ github.repository }} and assert the compiled script no longer contains the raw expression.

💡 Suggested assertion
require.NotContains(t, script, "${{")

This fails on the current branch, so it would catch the regression.

@copilot please address this.

Copilot AI commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@copilot recompile

Recompiled smoke-issues and committed the regenerated lock file in c5aa809e. The connector defaults now render as object literals.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@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. Fix failing check impacted-go-tests (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": "c5aa809e018ffb604a329cc7c604ec2d839c5f2c",
  "kind": "requested",
  "schema_version": "1",
  "state": "999b2b96f666871f78f987e2db2b99dc60feb81f0ce87a5756c074ba9d2c8309",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

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

Copilot AI commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@copilot recompile

Recompiled smoke-issues with the repository’s local gh-aw binary. The generated lock exactly matches the committed .lock.yml, so no file changes were needed.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@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.

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

Structured data
{
  "completed_task": 0,
  "head": "24863c7d101cc73ac3ad81cbaf35f86ce90d4d20",
  "kind": "requested",
  "schema_version": "1",
  "state": "b5599a6174ecc6f791306cb83f0d5b4bd0961d4ead9c4e48a841cd6e6d2afa80",
  "work": [],
  "workflow": "pr-sous-chef"
}

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

…18-connector-defaults-literal-be9b45ad4c4c20ac

# Conflicts:
#	pkg/workflow/connector_content_host_test.go

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

Copilot AI commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@copilot

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

Merged the latest main and resolved the connector fixture conflict in cbc30588. Build and full workflow recompile succeeded (367/367); generated lock diffs were omitted because push protection flagged compiler-generated placeholders.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@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.

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

Structured data
{
  "completed_task": 0,
  "head": "cbc3058816397707959ea77474ef6d45f1d4097e",
  "kind": "requested",
  "schema_version": "1",
  "state": "82cfaba220c95adcfbbba752d7e82c341206419c2c74020cb4a8870881d6673e",
  "work": [],
  "workflow": "pr-sous-chef"
}

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

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

…18-connector-defaults-literal-be9b45ad4c4c20ac

# Conflicts:
#	docs/public/cracktro/deck.js

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

Copilot AI commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts on this branch.

Merged the latest main and resolved the deck conflict in 98dcd9bc. The merge has two parents.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

…18-connector-defaults-literal-be9b45ad4c4c20ac

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

Copilot AI commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts on this branch.

Merged the latest main as e915d87e; Git auto-merged cleanly with no conflicts.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@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.

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

Structured data
{
  "completed_task": 0,
  "head": "e915d87ef51fada3bd8fbc08091e3239b08aa7cd",
  "kind": "requested",
  "schema_version": "1",
  "state": "11dd244a3bdd5871236e4cd48dc339be8f77e803b0d8736b1dfc05fe447f67a7",
  "work": [],
  "workflow": "pr-sous-chef"
}

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

…18-connector-defaults-literal-be9b45ad4c4c20ac

# Conflicts:
#	docs/public/cracktro/deck.js

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

Copilot AI commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

@copilot recompile

Recompiled all 367 workflows successfully. smoke-issues.lock.yml is already current and has no Buffer.from( occurrences. The latest-main merge is d1df5c4.

@copilot

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

Merged the latest main as two-parent commit d1df5c4.

@pelikhan
pelikhan merged commit a8c6c5c into main Nov 15, 2026
67 checks passed
@pelikhan
pelikhan deleted the static-analysis/rgs-018-connector-defaults-literal-be9b45ad4c4c20ac branch November 15, 2026 05:52
@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation cookie Issue Monster Loves Cookies! security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants