dsh-permission-gate: DSH Process-Level Access Gate and Tool Brake

Introduction

DeepSeek Harness (DSH) does not provide authentication mechanisms at the HTTP layer by default. In remote or unattended scenarios, this can allow browser pages to be accessed while agent tools remain available and invocable. To address these two issues, the dsh-permission-gate plugin provides a UI-level full-screen lock page and process-level tool lockdown.

Overview

This plugin is maintained by Juntiantan and is released under the MIT license. It does not replace real boundary authentication; instead, it acts as an in-process access control layer for DSH, preventing sensitive operations from being executed while not logged in.

Core Features

1. UI-Level Access Control

The plugin injects a full-screen lock page every time a DSH page is loaded. The page remains locked until a user is logged in. This mechanism prevents unauthorized users from viewing or interacting with the DSH interface directly in a browser.

2. Process-Level Tool Lockdown

This is the most critical security feature of the plugin. When no user is logged in, the plugin intercepts all agent tool invocations through ctx.tools.guard. This means that while locked, an agent cannot read files, run commands, open network connections, or spawn new sub-agents.

3. Session and Credential Management

  • Shared Session: A single login unlocks all open DSH pages. The session is kept in memory with a strict 60-minute idle timeout; after it expires, all pages are forced back to the login page.
  • Password Storage: Credentials are stored in the ~/.dsh/permission-gate directory using the scrypt algorithm with a random salt. The session itself exists only in memory; after restarting the DSH process, you must log in again, but the password is not reset.
  • Management Module: The native DSH settings module includes a Permission Gate configuration page, which can be used to enable or disable the gate or change the password.

4. Escape Hatch and Status Monitoring

  • Server-Side Escape Hatch: A plain HTML login page is provided at the /gate path, allowing login by directly accessing this path even if browser-injected scripts fail or are cached.
  • Status Chip: A collapsible status chip on the right side of the UI displays the remaining valid time in real time.

Installation and Activation

This plugin declares dsh.bundle and belongs to the profile layer. The installation process is handled automatically by DSH, and no manual editing of patch files is required.

dsh plugin --profile web add dsh-permission-gate

After installation, restart DSH once to scan the client list. On first access to the page, the system will ask you to set a password.

Typical Usage

  1. Unified Login: Log in once on any device, and open DSH pages on other devices will automatically unlock during the next polling cycle.
  2. Use It with a Real Network Boundary: Because this plugin does not protect the HTTP API, it must be used together with a real network boundary (such as WireGuard VPN, Tailscale, or a TLS reverse proxy) to prevent direct API calls from bypassing the gate.
  3. Password Management: Use the Permission Gate feature in the DSH settings module to change the password or disable the gate.
  4. Reset the Password: If you forget the password, delete the ~/.dsh/permission-gate file, restart DSH, and access the page again to set a new one.

Use Cases and Caveats

  • Not HTTP Authentication: This plugin only protects browser pages and in-process tool invocations, not DSH’s HTTP API endpoints. Any client that can reach the DSH port can call the API directly and bypass this plugin.
  • Boundary Configuration Is Required: Deployment must be bound to a loopback address or accessed through a VPN/reverse proxy; otherwise, the deployment may be less secure than not installing the plugin at all.
  • In-Memory Sessions: Sessions exist only in memory. Restarting the DSH process clears session state, and you must log in again.
  • Tool Exemptions: To allow locked agents to perform basic status reporting and ledger maintenance, the three tools get_goal, update_goal, and todo_write remain callable while locked.

Summary

dsh-permission-gate is a practical plugin for process-level security in DeepSeek Harness. It uses a UI lock page and a tool lockdown to address basic security risks in remote or unattended scenarios. Always keep its limitations in mind and deploy it behind a real network boundary.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye