Repository navigation
Conversation
openvscode-server was launched with `--connection-token <token>`, and the token is the session API key in keyed deployments. Both the `sh` launcher and the `node server-main.js` child kept it in their argv, which any local user can read from /proc/<pid>/cmdline. Write the token to a 0600 file in a private 0700 directory created per launch and pass `--connection-token-file` instead (supported by the bundled openvscode-server 1.109.5, available since 1.62). A restart via set_connection_token writes a fresh file; stop() and a failed start remove it. get_vscode_url() is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLppvEs62hAsfpCEiRzncq
Contributor
|
Contributor
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Contributor
1 of 5 tasks
The code-server migration supersedes the old token-file launch. Retain regression coverage that the token is delivered through stdin and absent from process arguments. Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
AGENT:
I'm an AI agent helping Engel Nyst (@enyst) with project work.
Why
The agent-server launches openvscode-server with
--connection-token <token>, and in keyed deployments that token issession_api_keys[0], the session API key. Both theshlauncher and itsnode .../server-main.jschild keep it in argv, and/proc/<pid>/cmdlineis world-readable (mode 444). In the Agent Canvas Docker image (agent-server 1.58.1, openvscode-server 1.109.5), host usernobodycould read the full session key from either process. Agent Canvas already moved its own static-server off argv (OpenHands/OpenHands#16420, issue OpenHands/OpenHands#16383); this is the same leak on the SDK side.Summary
tempfile.mkdtemp) and launch openvscode-server with--connection-token-fileinstead of--connection-token. The path is shell-quoted, and the token is no longer interpolated into the shell command.set_connection_tokenrestarts write a fresh file;stop()and a failedstart()remove it.get_vscode_url()is unchanged./proc/<pid>/cmdline.Issue Number
Fixes #6194
How to Test
uv run pytest tests/agent_server/test_vscode_service.py tests/agent_server/test_vscode_router.py→ 62 passed. Onmain6 of the new or changed tests fail, including the/proccmdline test, which shows--connection-token\x00<token>.tests/agent_server -k "vscode or init": 140 passed.uv run pre-commit run --files openhands-agent-server/openhands/agent_server/vscode_service.py tests/agent_server/test_vscode_service.py→ all hooks pass (ruff, pycodestyle, pyright, import rules).1.58.1-python(openvscode-server 1.109.5, whose--helplists--connection-token-file), the patchedVSCodeServicewas started asopenhandswith the container's session key. From the host,/proc/<pid>/cmdlineof both theshandnodeprocesses had--connection-token-file, no--connection-tokenand no key literal, andnobodyfound 0 lines with the key. The token file was 0600 (directory 0700, uid 10001),?tkn=<key>answered 302 and a wrong token 403, andstop()removed the directory. Before the change, the same image's processes had--connection-token <key>readable by host usernobody. The image's own agent-server is a PyInstaller binary, so the shipped image needs an SDK release with this change.Video/Screenshots
N/A (process argv change). Reproduction evidence is in #6194.
Type
Notes
--connection-token-filehas been in openvscode-server since 1.62; the image pins 1.109.5. The token file lives under the system temp dir, in a 0700 directory owned by the server user; openvscode-server reads it once at startup.Generated by Claude Code
🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdkpython-node-runtimepython-node-runtimepython-node-runtimegolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:90edfd3-pythonRun
All tags pushed for this build
About Multi-Architecture Support
90edfd3-python) is a multi-arch manifest supporting both amd64 and arm6490edfd3-python-amd64) are also available if needed