npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-trusted-host-proxy-403-fix

v0.7.0

Published

For DSH 0.1.5-rc.2, preserve trusted reverse-proxy settings persistence and provide a redacted in-browser effective-config viewer. Not an authentication layer.

Readme

dsh-trusted-host-proxy-403-fix

English | 中文

适用于 web profile 的独立 DeepSeek Harness 插件。0.7.0 精确适配 @deepseek-ai/[email protected]。

DSH 0.1.2+ 会对 Web 页面和 API 增加进程 Token/签名 Cookie 校验。对于已经在 DSH 前面部署 Cloudflare Access 等身份认证、同时通过 --trusted-host 限定公开主机名的反向代理场景,本插件只跳过受信 Host 请求的 Cookie 401,并保持远程设置、语言和主题的 host 持久化。

本插件不是身份认证层,也不会绕过 DSH 的 Host、Origin 或 Fetch Metadata 校验。非受信 Host、跨站请求和错误 Origin 仍会被拒绝。

安全边界

  • dsh web 必须继续只监听回环地址,不能直接暴露到公网。
  • --trusted-host 只填写客户端实际使用的规范 host[:port],不能带协议、路径、用户信息或通配符。
  • 公网入口必须由 Cloudflare Access、认证反向代理或等效网络隔离保护。
  • 浏览器请求的 Origin 主机和端口必须与 Host 一致;sec-fetch-site: cross-site 和 Origin: null 会被拒绝。
  • 插件不会改变已有 Cookie、进程 Token、重定向或非 401 响应。

设置持久化

浏览器半区会让已通过上述边界的反向代理页面使用与本机页面一致的 host 持久化:

  • 将 connection.isLoopback 和 ctx.remote.$host.isLoopback 保持为可使用 host 设置的状态。
  • 将共享 Settings mirror 从 memory 升级为 host,并调用 load() 恢复设置。
  • 将 Locale 与 Theme 控制器升级为 host 持久化。

这样可以保证设置 → 模型中的凭据状态、语言、外观和 Composer Enter 等选项在刷新或 DSH 进程重启后仍然保留。

生效配置查看

受信反向代理页面不使用 Host 桌面的“打开配置文件”操作,而是在设置页提供“查看生效配置”:

  • 从 DSH 现有 settings.describe() 边界读取当前进程已解析的 namespace 值。
  • 支持 YAML / JSON 切换、刷新和复制。
  • 密钥、Token 和密码继续使用 DSH schema 的服务端脱敏,插件不读取或返回原始 settings.yaml。
  • 展示内容是当前生效值,不包含磁盘文件的注释和原始排版。

安装

从 npm 安装正式版本:

dsh plugin --profile web add [email protected]

从 GitHub Release 安装:

dsh plugin --profile web add https://github.com/roojay/dsh-trusted-host-proxy-403-fix/releases/download/v0.7.0/dsh-trusted-host-proxy-403-fix-0.7.0.tgz

开发或发布前测试本地源码:

cd /absolute/path/to/dsh-trusted-host-proxy-403-fix
npm install --ignore-scripts --no-package-lock
dsh plugin --profile web add "$PWD"

本地源码必须先安装 peer dependencies。cordis.patch.yml 中的 trustedHosts 必须保持为 !!js ctx.webRuntime.trustedHosts,不要写死域名。

安装或切换来源后需完整重启 Web 进程,并继续传入公开主机名:

dsh web --port 3080 --trusted-host app.example.com

验证

先检查合并后的 profile:

dsh --profile web --dump-config

再从服务器回环地址验证首页边界:

# 受信 Host:无 DSH Cookie 时仍应加载首页
curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3080/ \
  -H 'Host: app.example.com'

# 非受信 Host:不得加载首页
curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3080/ \
  -H 'Host: evil.example'

# 错误 Origin:API 请求仍应为 403
curl -sS -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:3080/api/settings.describe \
  -H 'Host: app.example.com' \
  -H 'Origin: https://evil.example' \
  -H 'content-type: application/json' \
  -d '{}'

通过前置身份认证后,还应在真实浏览器中确认:会话列表可打开、消息可发送、设置 → 模型可读取和保存凭据,语言与主题在硬刷新和完整重启后保持不变,且“查看生效配置”只显示脱敏后的当前值。

开发

npm install --ignore-scripts --no-package-lock
npm test
npm pack

测试会固定核对 DSH 0.1.5-rc.2 的 peer 版本以及 HostConnectionService.requestRejection、authorizeIndex 接口,防止上游接口漂移后静默放行或破坏原有功能。

许可证

MIT。请求校验逻辑参考 @deepseek-ai/dsh-client-connection 的 MIT 实现。