dsh-remote-link: Securely Expose DSH Web UI to LAN with Agent Session Forking Support

Preface

The official web UI for DeepSeek Harness (DSH) is typically suitable for use in a local loopback environment. If you want to access the agent on your computer from a phone or a LAN device, directly exposing the web UI introduces issues such as authentication, session management, device management, and permission exposure.

dsh-remote-link offers a compromise: the plugin first authenticates on a separate gateway port, then reverse-proxies requests back to the loopback DSH official web UI, while also adding a fork_session session-branching tool to the model.

What This Is

dsh-remote-link is a DSH plugin, maintained by BotonJ, licensed under MIT.

It primarily addresses three things:

  1. Authenticates and reverse-proxies the DSH official web UI through a separate gateway port to loopback.
  2. Allows phone QR code pairing to access the agent on the computer.
  3. Adds a fork_session session-branching tool for the model.

The plugin is described as “zero core changes, zero runtime dependencies.”

Core Capabilities

Below are the main capabilities of the plugin.

Gateway Authentication and Reverse Proxy

The plugin performs authentication on a separate gateway port and reverse-proxies requests to the DSH web UI on loopback. This way, external clients can only access the interface — which would otherwise be exposed only on the local loopback — after passing gateway authentication.

Pairing and Sessions

The plugin uses a one-time pairing and session mechanism:

  • QR one-time pairing
  • HMAC challenge-response
  • HttpOnly Cookie sessions
  • Device registry

After pairing is completed, subsequent access uses session cookies rather than carrying long-term credentials in the URL.

Status Page

The plugin provides a /status status page that can display:

  • Link status
  • Device identity
  • Keepalive RTT
  • Upstream health
  • Tunnel heartbeat

Host Telemetry

The plugin calls:

/api/host.describe

and subscribes to:

/api/events.host

to obtain host-side telemetry information.

Discovery and Protection

The plugin also includes the following capabilities:

  • mDNS broadcast for non-loopback gateways
  • Basic Auth fallback
  • Client IP rate limiting
  • Authentication failure banning

fork_session

The plugin adds a fork_session tool to the model. This tool creates a child session using the most recent completed turn as the boundary, allowing the model to explore different directions without directly modifying the current main session thread.

Installation and Enabling

First, install the plugin in a local directory:

dsh plugin --profile web add ./dsh-remote-link

After installation, you need to configure the remote-link related items in the DSH web profile patch file:

$DSH_HOME/profiles/web/cordis.patch.yml

Configurable items include host, port, pairing, mdns, publicUrl, and more.

Upon startup, the plugin logs an ASCII representation of the one-time pairing QR code and a 6-digit short code.

You can scan the QR code directly with your phone to complete pairing; if scanning isn’t possible, you can open on any device:

http://<IP>:3081/pair

and then enter the short code.

Note a security restriction: if the gateway is bound to a non-loopback address, and no password is set and pairing is disabled, the plugin will refuse to load.

Typical Usage

Viewing the Status Page

Open in a desktop browser:

http://127.0.0.1:<port>/status

to view gateway uptime, WS connections, device identity, keepalive, upstream health, tunnel heartbeat, and more.

Triggering Remote Management Tools in the Chat Box

The plugin exposes some administrative actions as tools callable by the model.

For example:

  • Say “give me the pairing code” to the model to trigger remote_qr.
  • Say “check who’s connected / kick my old iPad” to trigger remote_devices list/revoke.
  • Say “fork and try a different direction” to trigger fork_session, creating a child session at the boundary of the most recent completed turn.

MiMo Code Standalone Runner Example

The README provides a standalone runner mode for MiMo Code. This mode first installs the 2-file patch in the mimo/ directory, then runs the upstream service and gateway:

bun run packages/opencode/src/index.ts serve --hostname 127.0.0.1 --port 3000
node runner-gateway.mjs '' 3081 3000

This mode places the local HTTP upstream behind the gateway, allowing phone scanning to access the corresponding service.

Security Boundaries and Notes

Several security boundaries should be clarified before use.

Plugin Runtime Permissions

The plugin runs with the current dsh process permissions. Before installation, it is recommended to review the source code, configuration items, and the MIT license to confirm they meet your security requirements.

Gateway Authentication Is the Only Trust Boundary

The gateway rewrites the Host header to loopback so requests can enter the DSH side. After passing gateway authentication, privileged RPCs such as settings.* and credentials.* can also be accessed.

Therefore, the security boundary of the plugin is the gateway authentication itself, not the assumption that “DSH is inaccessible from the external network.”

Cookies and Device Revocation

Session cookies are:

HttpOnly
SameSite=Strict

The server only stores the SHA-256 digest. After revoking a device, the corresponding session is immediately invalidated.

Limitations of the Short Code Path

The 6-digit short code is a weak shared secret. Its security relies on:

  • A 10/min rate limit bucket
  • A ban window
  • A 5-minute one-time TTL

It should not be treated as a high-entropy long-term credential.

Known Unresolved Risks

The README lists several known unresolved risks:

  • LAN sniffers may copy cookies and take over sessions.
  • devices.json may contain a plaintext deviceKey, with file permissions set to 0600.

Candidate Capabilities

The candidate capabilities noted in the README (approval offline push + long-term recovery code) are pending review and should not be treated as confirmed stable features.

Links

  • Directory page: https://www.skillhub.cn/plugins/BotonJ/dsh-remote-link
  • GitHub: https://github.com/BotonJ/dsh-remote-link
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye