Repository navigation
Conversation
Since 2026-12-02 the runtime rejects an upgrade that carries an Origin header with HTTP 403, so colab ssh failed on every fresh runtime while colab exec still worked. websocket-client sends Origin by default; pass suppress_origin=True and assert in the wire-contract test that the header never reaches the server.
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.
Summary
_connect_websocketnow passessuppress_origin=True, so the/colab/sshupgrade no longer carries
Origin: https://<runtime-host>.tests/test_ssh_wire_contract.pyasserts that the header never reaches theloopback server.
docs/06_ssh_access.md: log entry for the behavior change.Why (fixes #320)
Since 2026-12-02 the runtime rejects a
/colab/sshupgrade that carries anOriginheader with HTTP 403.websocket-clientsends that header by default,so
colab sshfailed on every fresh runtime whilecolab execstill worked.The runtime-proxy token is not the problem: the same token succeeds against
/api/kernels, and the 403 response echoes the sent Origin inaccess-control-allow-origin, which points at a runtime-side origin check.A CLI is not a browser, so it has no reason to send the header at all.
Changes
src/colab_cli/commands/ssh.py: one-line connect change plus a commentexplaining why the header must not be sent.
tests/test_ssh_wire_contract.py: the shared wire-contract assertion nowrequires
originto be absent from the captured upgrade request.docs/06_ssh_access.md: design-doc log entry.Verification
Offline:
mainwith the capturedOrigin: http://127.0.0.1:<port>header and passes with the fix (14 passed).The one failure in that file,
test_proxy_command_child_reads_the_parent_config, is a pre-existingWindows
PermissionErrorthat fails identically onmain.tests/test_ssh.py: the same 12 pre-existing Windows failures before andafter this change; no new failures.
uv run ruff check .anduv run ruff format --check .pass.Live (CPU runtime created and stopped during testing):
colab ssh -s <session> -- "echo hello-from-colab; uname -a"prints theremote output and exits 0.
with
Origin→403 {"message":"Forbidden"}; withsuppress_origin=True→101 Switching Protocols.colab stop, thencolab sessions→ no active sessions (no orphan).Thanks to @krunal-shah for the diagnosis and workaround in #320.