Repository navigation
Harden setup script temporary files and credential logging - #78464
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: 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.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: 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.
|
|
🧠 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.
|
|
✅ 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.
Reviewed the changed setup scripts and regression tests. The diagnostic files now use a private mktemp directory with cleanup, and API-key prefix logging is removed. No merge-blocking correctness or security issues found in the changed lines. Static review only; tests were not run per review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The core fix is sound: the predictable /tmp/gh-aw-* diagnostic paths are replaced by a private mktemp -d directory with a trap cleanup, and the API_KEY:0:8 prefix logging is removed from both server scripts. The existing shell suite passes (73/0). Two test-strength gaps remain, and both are posted inline.
📋 Key Themes & Highlights
Key Themes
- Regression guards are weak: the JS guard matches only the literal
API Key:, and the shell Test 0 greps source text instead of checking behavior.
Positive Highlights
- ✅ Private temp directory plus
trap ... EXITremoves the predictable-path risk and cleans up on every exit path. - ✅ Key values still reach
GITHUB_OUTPUT, which the PR describes; only the stdout prefix is dropped. - ✅ Tests were added in the same PR as the fix.
Pre-existing issue (not changed here)
checkout_exit=$?atsetup_cache_memory_git.sh:244runs afterif ! git checkout, so it always captures0. A genuine checkout failure therefore exits 0 at line 255. This is outside the diff, so it is noted here rather than blocking. A follow-up that captures the status before the negation would fix it.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
|
|
||
| # ── Test 0: Git diagnostics use private, unpredictable temporary paths ──────── | ||
| echo "Test 0: Git diagnostics use private temporary paths" | ||
| assert "diagnostic directory is created with mktemp" \ |
There was a problem hiding this comment.
[/tdd] Test 0 greps the script source. It passes even if the trap never removes the directory, or if the script writes diagnostics to another fixed path. Test 13 already drives the fsck branch, so this check can assert behavior instead.
💡 Suggested behavioral check
Run the script against a corrupted repo, as Test 13 does, then assert that no /tmp/gh-aw-git-fsck-* files exist and that the /tmp/gh-aw-cache-memory.* count matches its pre-run value. Keep the grep checks as a secondary guard.
@copilot please address this.
There was a problem hiding this comment.
Addressed in 4afb049: corruption recovery now checks that no predictable fsck diagnostic files remain and that the private diagnostic-path set is unchanged after execution. The source guards remain, and all 75 shell assertions pass.
|
|
||
| it.each(["start_safe_outputs_server.sh", "start_mcp_scripts_server.sh"])("%s does not log the API key", script => { | ||
| const content = fs.readFileSync(path.join(__dirname, "../sh", script), "utf8"); | ||
| assert.doesNotMatch(content, /API Key:/); |
There was a problem hiding this comment.
[/tdd] This guard only matches the literal text API Key:. The leak was the ${GH_AW_..._API_KEY:0:8} expansion, so a reworded log line such as echo "Key: ${GH_AW_SAFE_OUTPUTS_API_KEY:0:8}" would still pass.
💡 Suggested assertion
assert.doesNotMatch(content, /API_KEY:\d/);Matching the expansion catches a re-added key prefix regardless of its label.
@copilot please address this.
There was a problem hiding this comment.
Addressed in 4afb049: added the /API_KEY:\d/ guard for both startup scripts so a renamed log label cannot conceal reintroduced key-prefix slicing. All 7 startup tests pass.
There was a problem hiding this comment.
🟡 Changes recommended
The test-scripts target omits the new setup-cache regression script, leaving regressions that reintroduce predictable diagnostic paths unchecked by automated validation.
1 open issue
What changed in this PR
Hardens gh-aw setup scripts by isolating Git diagnostics and removing API-key prefixes from MCP server startup logs.
Changes:
- Stores Git diagnostics in a private temporary directory with exit cleanup.
- Removes API-key prefix logging while preserving credential forwarding through
GITHUB_OUTPUT. - Adds regression checks for diagnostic paths and credential logging.
| File | Description |
|---|---|
actions/setup/sh/start_safe_outputs_server.sh |
Removes API-key prefix logging. |
actions/setup/sh/start_mcp_scripts_server.sh |
Removes API-key prefix logging. |
actions/setup/sh/setup_cache_memory_git.sh |
Moves Git diagnostics into a private, automatically cleaned temporary directory. |
actions/setup/sh/setup_cache_memory_git_test.sh |
Adds checks against predictable diagnostic paths. |
actions/setup/js/start_safe_outputs_server.test.cjs |
Adds checks against API-key log labels in both startup scripts. |
Review effort: Max (adaptive)
| assert "diagnostic directory is created with mktemp" \ | ||
| "grep -q 'mktemp -d /tmp/gh-aw-cache-memory.XXXXXX' '${SCRIPT}'" | ||
| assert "fixed diagnostic paths are not used" \ | ||
| "! grep -Eq '/tmp/gh-aw-(git-fsck|checkout|merge)-' '${SCRIPT}'" |
There was a problem hiding this comment.
Addressed in 4afb049: added the cache-memory setup regression suite to test-scripts. The suite passes all 75 assertions.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "1b3af88a1ce9b1864801def64aee4b2af42f45d5",
"kind": "requested",
"schema_version": "1",
"state": "46bbe423a87ad9a530ce48682779e694f38cad62322eb2c6692c4a2923f5a069",
"work": [
"26583d185129738525bf55540b975ca315061f8be302859fc976dc1f3dc0dc54",
"7fdcb480e7a98cc7e0f466a49ad1c7f7e8c5cfc22f8fbcc711724ed335220761",
"87d010a05869c90dac5f7f07759c0fff448b0f8ae40361fe15b7bc140407ac0f",
"abfdc2fdb839cef195b2bd3ddd2ad824e1ab572836d1e6fd92ca80f111f86698"
],
"workflow": "pr-sous-chef"
}
|
…nce-triage-ai-scan-alerts Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…tests Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Updated from main via |
|
🎉 This pull request is included in a new release. Release: |

AI-scan alerts flagged setup-script risks involving temporary files, symlinks, command injection, and log leakage. This change addresses the locally confirmed predictable diagnostic paths and API-key-prefix logging.
mktemp -ddirectory and remove it on exit.GITHUB_OUTPUT.