Skip to content

Use readable MCP script env binding names to avoid secret scanning false positives - #78184

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan/mcp-scripts-env-name-hashing
Nov 16, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan/mcp-scripts-env-name-hashing

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

GitHub's secret scanner flagged the generated MCP script transport variable names (for example GH_AW_MCP_SCRIPTS_ENV_6769746875622d70722d7175657279_47485f544f4b454e) as passwords and rejected branch pushes with GH013. These are environment variable names, not token values, but the long hexadecimal components look like generic secrets.

Approach

mcpScriptEnvBindingName now produces readable names of the form:

GH_AW_MCP_SCRIPTS_ENV_<len>_<TOOL>_<NAME>
e.g. GH_AW_MCP_SCRIPTS_ENV_15_GITHUB_PR_QUERY_GH_TOKEN

The encoding stays injective, preserving the guarantee from ADR 73887 that distinct (tool, variable) pairs never collide:

  • Tool names: a-z -> A-Z, - -> _, digits unchanged.
  • Variable names: A-Z, 0-9, _ unchanged.
  • Any other byte -> x<HH>. Lowercase x is never produced otherwise, so escapes are unambiguous.
  • The encoded tool length prefix makes the tool/variable join unambiguous (a + B_C vs a-b + C).

Other changes

  • Recompiled lock files and updated both smoke-copilot wasm golden files.
  • Removed the golden-test normalization that rewrote hex GH_TOKEN bindings to GH_AW_MCP_SCRIPTS_ENV_TOKEN (Go and scripts/test-wasm-golden.mjs). It appears to have existed only to dodge the scanner; native and wasm goldens pass without it.
  • Updated the ADR description and JS test fixtures to the new format.
  • Added collision and readability assertions in mcp_scripts_renderer_test.go.

Notes for reviewers

  • The JS runtime only resolves bindings by the names listed in tools.json and strips the GH_AW_MCP_SCRIPTS_ENV_ prefix, so it doesn't depend on the old hex format.
  • TestDailyGoTestParallelizerUsesCodexCompatibleModel fails on main as well and is unrelated.

Replace hex-encoded GH_AW_MCP_SCRIPTS_ENV_<hex>_<hex> transport variable
names with an injective readable form GH_AW_MCP_SCRIPTS_ENV_<len>_<TOOL>_<NAME>.
Long hex identifiers were flagged by secret scanning as passwords (GH013).

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan marked this pull request as ready for review November 16, 2026 00:17
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 00:17
@github-actions

github-actions Bot commented Nov 16, 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 16, 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 #78184 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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 #78184 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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 · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

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.5K · ◷

@github-actions

github-actions Bot commented Nov 16, 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 · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.7K · ◷

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

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

Static review completed for the changed lines. I found no actionable correctness, security, performance, or maintainability issues. The grumpy-coder specialist pass was unavailable because its diff read was denied; this review therefore relies on independent analysis only.

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

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-3f74a555-9f83-4bc0-a45b-a7cd17433d0d","parents":[],"payload":{"id":"ldg-0f13164d-caa6-40ca-b718-3f4fc79b8fa1","operation":"append","value":{"finding_count":0,"head_sha":"03697ffe80f0df7c81f513549099d1e0deaaa02b","outcome":"no_findings"}},"sha":"sha256:da9997c4b0ed59c9b81c875a8e06ec370efd6ea83d00e5430f8cfd1ca8719503","timestamp":"2026-11-16T00:24:51.760Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-b3aab4c2-0125-4ef5-9ee8-e79160b00578","parents":[],"payload":{"id":"ldg-d963941d-4136-4920-8412-e765472176c0","operation":"append","value":{"finding_count":0,"head_sha":"03697ffe80f0df7c81f513549099d1e0deaaa02b","outcome":"aligned"}},"sha":"sha256:8b00c5fad20870baee5c5f54e00a7f7be729c44ec40d4210ba0477dcc8faddb0","timestamp":"2026-11-16T00:25:31.826Z","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.

🔵 Needs a closer look

The identifier encoder affects per-tool credential isolation, requiring cross-layer review of escape injectivity, manifest generation, startup bindings, and runtime resolution.

No open issues 🎉

What changed in this PR

This PR updates gh-aw’s compiler to generate readable MCP script environment binding names, addressing secret-scanning false positives while preserving distinct bindings for each tool and variable pair.

Changes:

  • Replaces hexadecimal names with readable, escaped components and a tool-length prefix.
  • Adds collision and readability assertions, updates JavaScript fixtures, and removes obsolete golden-test normalization.
  • Refreshes generated workflow locks, native and WebAssembly goldens, and the architecture decision record.
File Description
scripts/​test-wasm-golden.mjs Removes hexadecimal token-binding normalization.
pkg/​workflow/​wasm_golden_test.go Removes matching Go golden normalization.
pkg/​workflow/​testdata/​wasm_golden/​WasmBinary/​smoke-copilot.golden Updates WebAssembly expected bindings.
pkg/​workflow/​testdata/​TestWasmGolden_CompileFixtures/​smoke-copilot.golden Updates native expected bindings and ordering.
pkg/​workflow/​mcp_scripts_renderer_test.go Adds collision and readability assertions.
pkg/​workflow/​mcp_scripts_generator.go Implements readable, collision-free binding names.
docs/​adr/​73887-isolate-mcp-script-secrets-per-tool.md Documents the revised encoding scheme.
actions/​setup/​js/​mcp_scripts_environment.test.cjs Updates environment-binding test fixtures.
actions/​setup/​js/​mcp_dependencies_manager.test.cjs Updates credential-isolation test bindings.
.github/​workflows/​smoke-goose.lock.yml Refreshes homepage tool bindings.
.github/​workflows/​smoke-copilot.lock.yml Refreshes GitHub query tool bindings.
.github/​workflows/​smoke-copilot-arm.lock.yml Refreshes ARM smoke-test bindings.
.github/​workflows/​smoke-copilot-aoai-entra.lock.yml Refreshes Entra smoke-test bindings.
.github/​workflows/​smoke-copilot-aoai-apikey.lock.yml Refreshes API-key smoke-test bindings.
.github/​workflows/​smoke-claude-copilot.lock.yml Refreshes probe receipt bindings.
.github/​workflows/​smoke-agy.lock.yml Refreshes conformance tool bindings.
.github/​workflows/​github-mcp-structural-analysis.lock.yml Refreshes label and workflow query bindings.
.github/​workflows/​engine-conformance-pydantic-ai.lock.yml Refreshes Pydantic AI conformance bindings.
.github/​workflows/​engine-conformance-pi.lock.yml Refreshes Pi conformance bindings.
.github/​workflows/​engine-conformance-opencode.lock.yml Refreshes OpenCode conformance bindings.
.github/​workflows/​engine-conformance-mini-swe-agent.lock.yml Refreshes mini-swe-agent conformance bindings.
.github/​workflows/​engine-conformance-kiro.lock.yml Refreshes Kiro conformance bindings.
.github/​workflows/​engine-conformance-goose.lock.yml Refreshes Goose conformance bindings.
.github/​workflows/​engine-conformance-gemini.lock.yml Refreshes Gemini conformance bindings.
.github/​workflows/​engine-conformance-factory.lock.yml Refreshes Factory conformance bindings.
.github/​workflows/​engine-conformance-deepseek-harness.lock.yml Refreshes DeepSeek harness conformance bindings.
.github/​workflows/​engine-conformance-cursor.lock.yml Refreshes Cursor conformance bindings.
.github/​workflows/​engine-conformance-crush.lock.yml Refreshes Crush conformance bindings.
.github/​workflows/​engine-conformance-copilot.lock.yml Refreshes Copilot conformance bindings.
.github/​workflows/​engine-conformance-codex.lock.yml Refreshes Codex conformance bindings.
.github/​workflows/​engine-conformance-claude.lock.yml Refreshes Claude conformance bindings.
.github/​workflows/​engine-conformance-atomic.lock.yml Refreshes Atomic conformance bindings.
.github/​workflows/​engine-conformance-aider.lock.yml Refreshes Aider conformance bindings.
.github/​workflows/​engine-conformance-agy.lock.yml Refreshes AGY conformance bindings.
.github/​workflows/​deep-report.lock.yml Refreshes label and workflow query bindings.
.github/​workflows/​daily-regulatory.lock.yml Refreshes GitHub query tool bindings.
.github/​workflows/​daily-performance-summary.lock.yml Refreshes GitHub query tool bindings.
.github/​workflows/​daily-mcp-concurrency-analysis.lock.yml Refreshes audit run-ID bindings.
.github/​workflows/​daily-caveman-optimizer.lock.yml Refreshes optimizer run-ID bindings.
.github/​workflows/​agy-conformance-reusable.lock.yml Refreshes reusable conformance bindings.

Review effort: Balanced (dynamic)

@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 /codebase-design, /tdd, and /grill-with-docs. The core change is sound: the readable GH_AW_MCP_SCRIPTS_ENV_<len>_<TOOL>_<NAME> format is injective, the length prefix keeps the join unambiguous, and the old hex→TOKEN golden normalization can be removed safely. Go tests for the binding, secret collection, and wasm golden paths pass.

📋 Key Themes & Highlights

Key Themes

  • Lowercase variable names: byte-level escaping still produces long hex-like runs, which is the pattern this PR removes (encoder, inline comment).
  • Test gaps: no case pins the lowercase or x-escape path (renderer test).
  • Docs convention: the Proposed ADR was rewritten in place instead of amended (ADR 73887).
  • JS helper divergence: binding() in mcp_scripts_environment.test.cjs does not map - to _ (latent).

Positive Highlights

  • ✅ Collision tests cover dash/underscore and length-prefix joins.
  • ✅ Golden normalization removal is covered by native and wasm golden tests.
  • ✅ Duplicate GH_AW_MCP_SCRIPTS_ENV_TOKEN keys are gone, so bindings are unique.

Verification Limits

  • JS vitest for mcp_scripts_environment.test.cjs and mcp_dependencies_manager.test.cjs was not run. npm ci in actions/setup/js failed on a self-signed certificate from the sandbox registry proxy, so those tests are unverified.

@copilot please address the review comments above.

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

Comment thread pkg/workflow/mcp_scripts_generator.go Resolved
pelikhan and others added 2 commits November 15, 2026 16:37
Escape lowercase variable-name letters as x<UPPER> and other bytes as
x<3-digit decimal> so no encoded name produces hex-like runs, pin outputs
in tests, align the JS test helper with dash mapping, and record the
encoding change as a dated ADR amendment.

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan merged commit 628ee5f into main Nov 16, 2026
100 of 101 checks passed
@pelikhan
pelikhan deleted the pelikhan/mcp-scripts-env-name-hashing branch November 16, 2026 00:53
@github-actions

Copy link
Copy Markdown
Contributor

🎉 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants