myfire2014/dsh-admin-gateway

Plugin插件 Native原生 ⭐ 2 Notifications & Remote通知与远程

dsh-admin-gateway DeepSeek Harness(dsh)管理员验证网关插件。只需一个绑定在 Cloudflare 的域名。

Project Overview项目介绍

This is a native authentication gateway plugin built exclusively for DeepSeek Harness (DSH). It runs as a separate Node.js HTTP gateway in front of DSH’s default local web server, which only binds to localhost by default and lacks built-in authentication, TLS support, and origin security policies. All incoming requests are authenticated at the gateway before being reverse proxied to DSH, and it automatically rewrites request headers to pass DSH’s trusted API request checks. No changes to DSH core code are required to install and use this plugin.

The plugin includes multiple security features out of the box. It uses scrypt hashing and timing-safe equal comparison for secure admin password login, and sets HttpOnly SameSite=Strict session cookies stored in server memory with configurable TTL. It blocks brute force attacks by locking IPs after a configurable number of failed login attempts, prevents DNS rebinding via host whitelisting, sets a default 5MB maximum request body size to block large payload attacks, and adds standard security response headers to harden the gateway.

To install the plugin, run npm install dsh-admin-gateway then add it to your DSH profile with the dsh plugin command. It is recommended to store the admin password in the DSH_ADMIN_PASSWORD environment variable rather than hardcoding it in the config file, and set file permissions to 600 to keep the password secure. When using Cloudflare Tunnel for public exposure, only point the tunnel to the gateway port (default 3081), leave DSH bound to localhost on port 3080 to keep it unreachable from unauthenticated public requests. The plugin is licensed under MIT.

这是专为 DeepSeek Harness (DSH) 开发的原生管理员验证网关插件。它在 DSH 默认的 HTTP 服务器前新增一个独立的 Node.js HTTP 网关,先对所有请求做管理员身份验证,验证通过后再反向代理到 DSH 本体,增加了多层安全防护,且无需修改 DSH 的任何一行源代码。

核心功能包括使用安全哈希与时序安全比较的管理员密码登录、HttpOnly SameSite=Strict 会话 Cookie、登录失败 IP 限速锁定防暴力破解、Host 头白名单校验防 DNS 重绑定、请求体大小上限限制,还会自动改写请求头,满足 DSH 对可信请求的检查要求。

配合 Cloudflare Tunnel 使用可将 DSH Web 暴露到公网,仅需一个绑定 Cloudflare 的域名,无需公网 IP、无需开放防火墙端口、无需额外购买服务器,自带 Cloudflare 提供的 HTTPS 和 DDoS 防护,始终保持 DSH 本体仅本地可访问,未认证请求永远无法触达 DSH。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-admin-gateway

把 myfire2014/dsh-admin-gateway 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-admin-gateway

DeepSeek Harness (dsh) 管理员验证网关插件。

核心优势

  • 零成本公网暴露:只需一个绑定在 Cloudflare 的域名,无需公网 IP、无需开防火墙端口、无需购买服务器,一条 Cloudflare Tunnel 即可让 dsh web 安全上线公网(HTTPS / DDoS 防护全由 Cloudflare 提供)
  • 开箱即用的安全防线:管理员密码登录 + 会话 Cookie + 防暴力破解限速 + 防 DNS rebinding,未认证流量永远到不了 dsh 本体
  • 即插即用:npm 安装 → 配置密码 → 绑定域名,三步完成,无需改 dsh 一行代码

它解决什么问题

dsh 的 HTTP 服务器(ctx.webServer)没有请求级中间件钩子,host 默认绑定 127.0.0.1,无 TLS / 认证 / origin 策略。本插件自起一个独立的 node:http 网关,先做管理员验证,通过后反向代理到 dsh web 本体,并正确改写 Host / Origin / Referer 头以满足 dsh Connection 信任检查(isTrustedApiRequest)。

配合 Cloudflare Tunnel 使用时,隧道只把流量送到网关端口,未认证请求永远到不了 dsh 本体。

功能特性

  • 管理员密码登录(scrypt 哈希 + timingSafeEqual 时序安全比较)
  • HttpOnly + SameSite=Strict 会话 Cookie,服务端内存会话,TTL 可配
  • 登录失败按 IP 限速锁定(防暴力破解)
  • Host 头白名单校验(防 DNS rebinding)
  • 请求体大小上限(防超大报文攻击)
  • 可选 per-IP 请求速率限制
  • 安全响应头(X-Frame-Options / X-Content-Type-Options / Referrer-Policy)
  • /api 未认证返回 401 JSON;浏览器页面未认证 302 跳转登录页
  • 反向代理时改写 Host / Origin / Referer,满足 dsh 信任检查
  • WebSocket / SSE 升级代理(dsh web UI 依赖事件流)

安装

npm install dsh-admin-gateway

作为 dsh 插件(bundle)安装到 profile:

# 在插件目录的父目录执行(不要在插件目录内写 ./dsh-admin-gateway)
cd /path/to/parent && dsh plugin --profile web add ./dsh-admin-gateway
# 或通过 npm 安装包名引用
dsh plugin --profile web add dsh-admin-gateway

确认插件已生效:

dsh --profile web --dump-config | grep -A3 'admin-gateway'
# 看到 "# == dsh-admin-gateway" 层 = 成功

配置

插件通过 cordis.patch.yml(或 profile 的配置层)注入,示例:

- insert:
    - id: admin-gateway
      name: dsh-admin-gateway
      config:
        port: 3081
        upstream: 'http://127.0.0.1:3080'
        allowedHosts:
          - dsh.example.com
        sessionTtlMs: 43200000
        maxBodyBytes: 5242880

配置项

字段 默认值 说明
port 3081 网关监听端口
host 127.0.0.1 网关监听地址,只应绑定回环(由 cloudflared 从本机连入)
upstream http://127.0.0.1:3080 上游 dsh web 地址
adminPassword '' 管理员密码;优先取环境变量 DSH_ADMIN_PASSWORD,其次取此值。两者都为空时插件启动报错
sessionTtlMs 43200000 (12h) 会话有效期(毫秒)
cookieName dsh_admin_session 会话 Cookie 名称
loginMaxAttempts 5 登录失败限速:窗口内允许的最大失败次数
loginWindowMs 600000 (10min) 登录失败限速窗口(毫秒)
loginLockMs 600000 (10min) 锁定时间(毫秒),超过 maxAttempts 后锁定该 IP
maxBodyBytes 5242880 (5MB) 请求体大小上限(字节)
reqLimitPerMin 0 可选:每 IP 每分钟最大请求数,0 表示不限制
allowedHosts [] Host 白名单(防 DNS rebinding);留空接受任意 Host
allowedIps [] 可选:IP 白名单,留空不限制来源 IP

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-ui-wallpaper 下一个 Next dsh-html-artifact →