Skip to content

launch: Encode agent session titles for command safety - #334304

Merged
Megan Rogge (meganrogge) merged 2 commits into
mainfrom
agents/encode-session-title
Sep 3, 2026
Merged

launch: Encode agent session titles for command safety#334304
Megan Rogge (meganrogge) merged 2 commits into
mainfrom
agents/encode-session-title

Conversation

@meganrogge

Copy link
Copy Markdown
Collaborator

Summary

  • encode originating agent session titles as URL-safe Base64 before forwarding them to Code OSS
  • decode titles only after they cross the Windows cmd.exe /c launcher boundary
  • keep arbitrary chat-derived titles out of shell syntax while preserving the exact displayed title

Follow-up to #334290.

Validation

  • targeted ESLint
  • npm run typecheck-client
  • npm run transpile-client
  • Bash and PowerShell parser validation
  • end-to-end launch with C&C "%PATH%" ! $HOME; verified the process received only URL-safe Base64 and the visible and accessible Command Center labels reproduced the exact original title

Pass the originating session title as URL-safe Base64 so chat-derived cmd metacharacters never cross the Windows launcher shell boundary as raw text. Decode the value only inside the native workbench environment.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 3, 2026 16:34

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 review overview

🟡 Changes recommended

The Bash encoder permits dash-prefixed titles to be interpreted as Node options, including executable --eval input.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity .agents/​skills/​launch/​scripts/​launch.sh — Terminate Node's option parsing before passing the untrusted title. As written, a title beginning…
What changed in this PR

Encodes agent session titles as Base64URL across launcher boundaries and decodes them in the workbench.

Changes:

  • Adds the --session-title-base64 argument.
  • Encodes titles in Bash and PowerShell launchers.
  • Decodes titles in the native environment service.
File Description
environmentService.ts Decodes the session title.
argv.ts (node) Registers the encoded argument.
argv.ts (common) Types the encoded argument.
launch.sh Encodes titles before launch.
launch.ps1 Encodes titles before launch.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .agents/skills/launch/scripts/launch.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved after current-head Copilot Code Review and GPT Luna found no security issue in the full PR patch.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: d536fa60 Current: 1547e2fe

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

Errored (8)

Fixtures that failed to render — no screenshot was produced.

sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunning/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunning/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunningAutoStart/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunningAutoStart/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostDisconnected/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostDisconnected/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/Connecting/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/Connecting/Light — unknown error (no image hash produced)
unknown error (no image hash produced)

roblourens
roblourens previously approved these changes Sep 3, 2026
Prevent dash-prefixed session titles from being interpreted as Node options by the launch-time Base64URL encoder.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meganrogge
Megan Rogge (meganrogge) merged commit 60bb3f6 into main Sep 3, 2026
60 of 61 checks passed
@meganrogge
Megan Rogge (meganrogge) deleted the agents/encode-session-title branch September 3, 2026 19:22
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 3, 2026
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.

5 participants