Skip to content

fix: publish the container transcript websocket on 127.0.0.1 only - #96

Merged
Mr-Pepe merged 1 commit into
preferencemodel:mainfrom
Oskii:fix/publish-websocket-localhost
Oct 19, 2026
Merged

Mr-Pepe merged 1 commit into
preferencemodel:mainfrom
Oskii:fix/publish-websocket-localhost

Conversation

@Oskii

@Oskii Oskii commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

When you run an evaluation in Docker or Podman, anyone on your network can watch the entire run live. Karotte opens port 8001 so the terminal UI on your computer can show the transcript as it happens, and that stream has no password. Because the container command leaves 127.0.0.1 off --publish, Docker and Podman open that port to every machine on the network instead of only yours. Anyone on the same Wi-Fi, office network, or shared server can connect to ws://<your-ip>:8001 and read the task prompt, the model's replies, every command and file the model touches, the submitted answers, and the score. Even if they connect late, the server replays the whole run from the start.

The Apple VM, Firecracker, and Modal paths already lock this port to 127.0.0.1. apple_container.py even has a comment explaining why:

# src/karotte/apple_container.py
# `--publish` binds every interface unless given an address.
if not prepare_only:
    port = run_config.websocket_config.port
    command.extend(["--publish", f"127.0.0.1:{port}:{port}"])

get_container_run_command in src/karotte/run_helpers.py (used for docker, docker:gvisor, podman, and nerdctl) left 127.0.0.1: off:

# src/karotte/run_helpers.py
if not prepare_only:
    command.extend(
        [
            "--publish",
            f"{run_config.websocket_config.port}:{run_config.websocket_config.port}",
        ]
    )

Why

The live stream is only meant for the terminal UI on the machine running karotte run. Inside the container, the WebSocket server accepts every connection and sends every event from the start of the run. Leaving the host port open on all network interfaces turns a local UI pipe into an unauthenticated feed of the evaluation, including private tasks, file contents, and grading output.

How

  • Pass 127.0.0.1:{port}:{port} to --publish in get_container_run_command, matching apple_container.py.
  • Update TestGetContainerRunCommand.test_includes_port_publish to check for 127.0.0.1:{port}:{port}.

Testing

uv run --frozen --extra test python -m pytest tests/test_run_helpers.py::TestGetContainerRunCommand::test_includes_port_publish -n 0 -q

test_includes_port_publish fails on 20ce4b2 (8001:8001 vs 127.0.0.1:8001:8001) and passes with this patch.

@Oskii
Oskii requested a review from Mr-Pepe as a code owner October 19, 2026 13:04
@Oskii Oskii changed the title Publish the container transcript websocket on 127.0.0.1 only fix: publish the container transcript websocket on 127.0.0.1 only Oct 19, 2026

@Mr-Pepe Mr-Pepe 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.

Looks good!

@Mr-Pepe
Mr-Pepe enabled auto-merge (squash) October 19, 2026 16:49
@Mr-Pepe
Mr-Pepe disabled auto-merge October 19, 2026 17:16
@Mr-Pepe Mr-Pepe closed this Oct 19, 2026
@Mr-Pepe Mr-Pepe reopened this Oct 19, 2026
@Mr-Pepe Mr-Pepe closed this Oct 19, 2026
@Mr-Pepe Mr-Pepe reopened this Oct 19, 2026
@Mr-Pepe
Mr-Pepe merged commit c8b90dc into preferencemodel:main Oct 19, 2026
18 of 24 checks passed
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.

2 participants