Skip to content

Harden temporary files for cache commits, MCP shell outputs, and installer logs - #76954

Merged
pelikhan merged 5 commits into
mainfrom
pelikhan/ai-scan-temporary-files
Nov 12, 2026
Merged

pelikhan merged 5 commits into
mainfrom
pelikhan/ai-scan-temporary-files

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Addresses the temporary-file handling reported by AI Scan alerts 1094, 1098, and 1087. Shared fixed paths can follow planted symlinks; shell-handler output creation also lacked exclusive allocation.

  • Allocate cache-commit diagnostics and installer logs inside private temporary directories, retaining existing diagnostics, best-effort commit behavior, installation fallback, and timeout handling.
  • Allocate MCP shell outputs exclusively with mode 0600 inside a private directory. Retain the original file descriptor through readback so replacing the pathname cannot redirect reads.
  • Clean up on completion and failure, keep both installer copies synchronized, and add isolated planted-link, cleanup, allocation-failure, and timeout regressions.

Validation

  • TMPDIR=/private/tmp make agent-report-progress passed, including build, JavaScript lint, shell policy checks, and 15 shell-handler tests.
  • Runtime TypeScript checking and cache-commit regressions passed.
  • Both installer copies passed 24 checksum cases and four private-log scenarios each; mirrors match byte-for-byte.
  • Cache-script shellcheck and diff checks passed. Broader installer shellcheck findings are unchanged from the base revision.

Caveats

Validation ran on macOS, so existing Linux-only installer behavior cases were skipped. The canonical TMPDIR avoids an existing macOS cwd-path assertion mismatch; installer suites ran without ambient GH_TOKEN to preserve their checksum retry expectations. No live AI Scan rescan was performed.

Predictability exploitation of the former shell-handler suffix is not confirmed, and the cache diagnostic path is outside the ordinary agent shared /tmp/gh-aw mount, so ordinary-agent escape is not confirmed. Installer local exploitability depends on platform symlink protections and victim permissions. No alerts were dismissed or suppressed, and no workflows were dispatched.

…aller logs

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 11, 2026 20:26
Copilot AI dynamic review requested due to automatic review settings November 11, 2026 20:26

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 2 commits November 11, 2026 23:50
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…orary-files

# Conflicts:
#	actions/setup-cli/install.sh
#	install-gh-aw.sh
#	scripts/test-install-script.sh

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved and merged main, preserving the private installer log protections and combining the installer diagnostic tests. Merge commit: 7410da38a9.

@pelikhan
pelikhan merged commit 280475c into main Nov 12, 2026
51 checks passed
@pelikhan
pelikhan deleted the pelikhan/ai-scan-temporary-files branch November 12, 2026 01:33
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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.

3 participants