dsh-admin-gate: Adding a Host-Side Management Gate at the Harness Entry Point

Introduction

When DeepSeek Harness (DSH) runs on a local machine or an internal network, the browser typically opens with full capabilities: reading the workspace, invoking agent tools, and modifying settings. If you only want to let visitors demo or browse read-only, a front-end overlay alone isn’t enough—fetch('/api/...') calls in the page will still fire. Below we introduce the community plugin dsh-admin-gate (maintained by fish133), which enforces identity and permission checks before anyone enters Harness. The gate lives on the host side, so clients cannot bypass it.

What Is This

dsh-admin-gate puts a gate in front of Harness: admins enter with a password; guests can enter without one but may only call a whitelisted set of /api endpoints and agent tools. It supports multiple admins, each with an independent password; conversations are isolated per account, and guests cannot see admin sessions. Categorized under admin-security, the current package version is 1.2.2 (MIT License). Directory page: SkillHub — dsh-admin-gate; source code: github.com/fish133/dsh-admin-gate.

Core Features

  • Admin password: scrypt salted hash; only the hash is stored, never the plaintext
  • Passwordless guest access: only whitelisted APIs and tools are permitted
  • Multiple accounts: multiple admins, each with an independent password
  • Conversation isolation: sessions are scoped by ownership; the list filters out unauthorized entries rather than throwing errors
  • No-guest mode: the guest entry point can be disabled entirely
  • Three modes: admin-only (default) / guest / open, switchable at any time; switching to admin-only immediately disconnects any active guests
  • Login rate limiting: 5 failed attempts within 10 minutes triggers a 5-minute lockout
  • Atomic writes: the state file is written to a temp file first, then renamed into place
Mode Who can enter Use case
admin-only Admins only No guests; the gate is for the owner alone
guest Admins + guests Guests enter without a password, restricted to a whitelist
open Everyone Gate disabled; equivalent to turning off the plugin

Why the Gate Lives on the Host

A full-screen client-side overlay can only hide the UI; it cannot block API calls. The plugin intervenes on the host side:

Hook What it does
connection.admit / admitConnection / authorizeIndex Issues a Peer with an identity tag (guest / a specific account)
connection/request Returns 401 for /api calls that haven’t passed the gate; in guest mode, additionally enforces the endpoint whitelist, returning 403 for out-of-scope calls
sessionController method wrappers Checks ownership by sessionId
tools.guard() In a guest turn, only whitelisted tools are allowed through
webserver/index-inject On page load, queries the gate state; if not passed, redirects the entire page to the gate page
/admin-gate/* Gate page and JSON API; not mounted under /api

Even if the injected redirect script is bypassed, the /api-side rejections still take effect.

Conversation ownership is recorded in the sessions field of $DSH_HOME/admin-gate.json; legacy conversations that have no recorded owner are treated as “orphaned” and visible to admins only.

Default Guest Permissions (Conservative)

The plugin does not make the call for the owner on “how much identity to lend out”:

  • Endpoints: biased toward read-only (session list/history, workspace files, model catalog, skill list, settings/describe, etc.), excluding session/prompt—allowing it would let a guest have the agent act on the owner’s behalf on the local machine
  • Tools: by default only web_search / web_fetch; does not include read / bash / write

If you need guests to chat, explicitly add session/prompt to the endpoint list; if they need to read files, explicitly add read.

Installation & Activation

In the DSH ecosystem, plugins are commonly attached as profile bundles. The official README provides the following steps.

  1. Link the repo into the profile’s dependencies (replace the path with your local clone or download directory):
cd /root/.dsh/profiles/web
pnpm add link:/path/to/dsh-admin-gate
  1. In the profile’s package.json, reference it under dsh.profile.bundles:
"@local/dsh-admin-gate"
  1. Restart Harness, or toggle @local/dsh-admin-gate off and on again under “Plugins” in the settings page.

  2. After installation, visit /admin-gate to set the first admin password (at least 4 characters).

Typical Usage

  1. On first visit to /admin-gate, follow the prompt to set an admin password; once authenticated, you enter Harness.

  2. Subsequent visits from the root path / will automatically redirect to /admin-gate.

  3. On the gate page or under the “Admin Password” section in the Web settings page, you can: change the password (this kicks out other admin sessions), add or remove admin accounts, switch between the three modes, and adjust the guest endpoint and tool lists.

Default state file path: /root/.dsh/admin-gate.json (i.e., $DSH_HOME/admin-gate.json). Structure example (refer to the README for the authoritative field definitions):

{
  "version": 3,
  "mode": "guest",
  "accounts": {
    "<id>": { "name": "管理员", "salt": "...", "hash": "...", "n": 16384, "r": 8, "p": 1, "createdAt": 0 }
  },
  "sessions": { "session-abc": "acct:<id>" },
  "guest": { "endpoints": ["..."], "tools": ["..."], "customized": false }
}

Forgotten password: delete the file and reopen /admin-gate to reset. Session tokens exist only in memory; after a Harness restart, you must pass the gate again.

Use Cases & Caveats

Who it’s for: those running Harness on a local machine or LAN and need “owner password to enter + guests with limited read-only/demo access,” while also isolating multi-admin conversations and preventing guests from using the owner’s identity to read all sessions.

Permissions & audit: the plugin runs with the current DSH process’s privileges; relaxing the guest list (especially session/prompt, bash, read) is equivalent to lending out the local agent’s capabilities. Before installing, read the source code and the MIT license, and evaluate the trust boundary yourself.

Known limitations (stated in the README):

  • Only applies to the browser path; local CLI and API tokens obtained via /connect do not go through the gate
  • The gate page carries its own HTML styling and does not follow the Harness theme
  • Call chains that completely bypass HTTP (e.g., self-triggered scheduled tasks) will be let through as if they were the owner

Upstream includes tests: node tests/gate.test.mjs (47 cases), node tests/identity.test.mjs (32 cases); identity and ownership coverage is primarily in the latter.

Conclusion

dsh-admin-gate centralizes the decisions of “who can enter Harness, who can call which APIs and tools, and whose conversations are visible to whom” on the host side, rather than relying solely on a front-end overlay. If you manage web bundles via profiles, follow the README to link in @local/dsh-admin-gate with pnpm link, then complete initial setup from /admin-gate.

  • Directory page: https://www.skillhub.cn/plugins/fish133/dsh-admin-gate
  • GitHub: https://github.com/fish133/dsh-admin-gate

SkillHub is a community plugin directory and has no official affiliation with DeepSeek / 幻方. DSH itself continues to follow the “everything is a plugin” extension model; whether to enable this plugin is up to your local profile.

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

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

Xiaoye