TecFancy/dsh-auth-gate
Login gate for the DeepSeek Harness (dsh) web surface: password or shared-token authentication, session cookies, rate limiting, and a user-management CLI.
项目介绍Project Overview
dsh-auth-gate 是一个面向 DeepSeek Harness (dsh) Web 实例的登录网关插件,统一拦截页面、API 与 WebSocket 请求,未登录访问将跳转登录页或返回 401。提供密码模式(每管理员独立账号,密码哈希存储)与共享令牌模式两种鉴权方式,支持浏览器登录与脚本 Bearer Token 直连,集成登录限流、安全 Cookie 等安全机制,并附带 dsh-auth 命令行工具用于用户管理。适用于将 dsh 公网部署时为智能体与会话提供访问控制。注意:插件仅保护 dsh Web 入口,无法替代操作系统与配置文件层面的安全防护。
dsh-auth-gate is a login gateway plugin for DeepSeek Harness (dsh) web instances, intercepting every page, API call, and WebSocket connection and redirecting unauthenticated visitors to a login page or returning 401. It supports password mode with hashed, per-admin credentials and a shared token mode, works for both browsers and Bearer-token scripts, and includes rate limiting, secure session cookies, and a fail-closed default. A small dsh-auth CLI manages users. Use it whenever a public dsh deployment needs access control for agents, sessions, and LLM credentials. Caveat: it secures only dsh's web surface, so server-level hardening and private config files remain necessary.
请帮我了解并安装插件:【dsh-auth-gate】【https://github.com/TecFancy/dsh-auth-gate】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add dsh-auth-gate
把 TecFancy/dsh-auth-gate 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-auth-gate
English | 简体中文
A login door for your DeepSeek Harness (dsh) web instance. Put it in front of a public dsh deployment and nobody can reach your agents, your chat sessions, or your LLM credentials without signing in first.
What it does
Everything needs a login. Every page, API call, and WebSocket connection is checked. Visitors without a valid session are sent to a simple login page (or rejected with
401for API/script requests).Two ways to sign in (pick one in the configuration):
- Password (recommended): each admin gets a username and password.
- Token: one shared secret token for the whole instance.
Works for browsers and scripts. Browsers use the login page; scripts and curl can pass
Authorization: Bearer <token>and skip the page entirely.Safe by default. Passwords are stored hashed, logins are rate-limited (repeated wrong attempts temporarily lock the address), session cookies are secure, and any missing or broken configuration blocks access instead of silently opening the door.
A small command-line tool for managing users:
dsh-auth user add admin --password-stdin # add a user dsh-auth user list # list users dsh-auth user disable admin # block a user's future logins
Quick start
# 1. Install the plugin from npm into your dsh profile.
# Since 0.4.1 the package declares a `dsh.bundle` manifest, so `dsh plugin add`
# also registers the mount (dsh.profile.bundles) automatically:
dsh plugin --profile web add dsh-auth-gate
# 2. Create an admin account
printf '%s\n' 'choose-a-strong-password' | dsh-auth user add admin --password-stdin
# 3. Turn on password login: override the plugin config in $DSH_HOME/cordis.patch.yml
# (a ready-to-use config-override template ships in deploy/cordis.patch.yml;
# see Configuration below — the mount itself needs no manual patch row)
# 4. Restart dsh. Open your site — you will be asked to sign in.
See it in action
Visitors without a session are sent to the login page:

After signing in, they land on your instance:

A prominent Sign out / 退出登录 button sits inside the Settings panel
(the Settings → General page, below the last preference row). It's a centered,
danger-styled filled button (16px door icon + localized label, theme tokens
for light/dark), and its label follows the GUI language through the same
locale mechanism the Settings language switch uses. Clicking it runs the same
native POST /auth/logout?next=/ flow as before.
Configuration
The bundle mount (id dsh-auth-gate, inserted by dsh plugin add) uses the
default config: mode: "token" backed by the DSH_AUTH_TOKEN environment
variable. To change it, override the config in $DSH_HOME/cordis.patch.yml
(or the profile's cordis.patch.yml — a ready-to-use override template ships
in deploy/cordis.patch.yml). The override targets the mounted row by id
(no insert — adding one would double-mount the plugin):
- id: dsh-auth-gate
config:
mode: "password" # "password" (recommended) or "token"
cookieSecure: true # keep true when you use https
| Option | Default | What it does |
|---|---|---|
mode |
"token" |
"password" = username/password login; "token" = one shared secret |
sessionTtl |
604800 |
How long a login lasts (seconds) before you must sign in again |
cookieName |
dsh_auth |
Name of the session cookie (rarely needs changing) |
tokenRef |
"DSH_AUTH_TOKEN" |
Token mode only: which environment variable holds the shared secret |
cookieSecure |
true |
Set to false only if you are testing over plain http |
usersFile |
"" |
Password mode: where your user list lives. Defaults to $DSH_HOME/auth/users.yaml |
Deployment
- Reverse-proxy deployment guide — Caddy/nginx
setups, the browser-trust fence gotcha (Settings-page
403s behind a proxy, and why auth alone doesn't fix them), and the recommended semi-shell topology. docs/deployment.md— ops checklist, acceptance steps (A–I) and troubleshooting. Chinese version:docs/deployment_zh.md.
Requirements
- Node ≥ 22.19 and pnpm on the server.
- The dsh
webprofile running (dsh --profile web). - If
cookieSecureistrue, your site must be served over https (browsers refuse secure cookies on plain http).
License
Notes & limitations
- Disabling a user only stops new logins; already-signed-in sessions stay valid until they expire.
- Login rate limiting resets when the server restarts.
- Behind a reverse proxy, rate limiting counts by the proxy's address.
- Sign out from the GUI: a prominent "Sign out / 退出登录" button sits in the
Settings panel (Settings → General, bottom) — client half, requires the
web app's client bundle (dsh 0.1.0-rc.6+); the direct
/auth/logout?next=/URL always works as a fallback. - The plugin only protects dsh's web surface. It is not a replacement for
server-level security: keep the server OS user locked down and the config
files private (
.credentials.yamlandauth/users.yamlare created with0600permissions).
nexu-io/open-design
ruvnet/ruflo
amruthpillai/reactive-resume
volcengine/OpenViking
Molunerfinn/PicGo
titanwings/colleague-skill
nocobase/nocobase
Tencent/WeKnora