Introduction¶
DeepSeek Harness (DSH) is an AI coding agent runtime designed for local desktop workflows, defaulting to 127.0.0.1. Once you wish to expose it to mobile devices on the LAN or deploy it to a cloud server, you will encounter several obstacles:
- Calls to privileged interfaces (e.g.,
settings.describe,llm.providers) from non-localhost sources will be blocked with a 403 Forbidden, preventing remote model switching. - Mobile browsers in pure HTTP environments lack a Secure Context,
crypto.randomUUIDis undefined, causing all RPC failures. - There is no authentication mechanism after exposing ports to the LAN or public internet; anyone on the same network can create sessions and execute commands via the agent.
dsh-plugin-auth-guard targets this set of issues: it binds and exposes the network, injects mobile polyfills, and builds a default-deny authentication gateway at the TCP layer. Below is an introduction to its functions, installation, and configuration.
What is it¶
dsh-plugin-auth-guard is the authentication and access control plugin for DeepSeek Harness (DSH). Author: lijx122, MIT License, requires Node.js >= 20. In one sentence: an enterprise-grade zero-trust authentication, LAN/public access control, and security gateway plugin.
DSH’s philosophy is that everything is a plugin, and this plugin is also integrated in a bundle form: it intercepts HTTP request and WebSocket upgrade events at the TCP server layer to build a Default-Deny zero-trust gateway — requests not on the whitelist must pass authentication first.
Core Features¶
Network Exposure and Privileged RPC Proxy¶
- Binds the DSH Web GUI to
0.0.0.0:3080and dynamically enumerates all active LAN IPv4 interfaces. - Securely proxies privileged RPC (
settings.describe,llm.providers,credentials.*) for authenticated clients, eliminating 403 Forbidden errors. - Dynamically injects a mobile
crypto.randomUUIDpolyfill into<head>viatapIndexto ensure mobile devices work properly over pure HTTP.
Default-Deny Gateway¶
- Intercepts HTTP
requestand WebSocketupgradeevents at the TCP server layer. - Unauthenticated access to core RPC (
/api/*), plugin management (/api2/*), and sidebar routes (/sidebar/*) is blocked with HTTP 401 or the WebSocket is directly destroyed.
Credentials and Token Lifecycle¶
- Passwords are stored as 32-byte salted Scrypt hashes; sensitive configuration fields are declared with
.role('secret')to prevent plaintext leakage. - Uses
crypto.timingSafeEqualfor constant-time comparison to prevent timing side-channel attacks. - HMAC-SHA256 tokens embed the current password fingerprint; modifying the password immediately revokes all tokens globally at the millisecond level.
- Automatically terminates all active remote terminal/event WebSockets when the password is changed or when logging out.
Anti-Forgery and Rate Limiting¶
- Validates
req.socket.remoteAddressto preventHost: 127.0.0.1spoofing and proxy loopback reversal. - IP sliding window rate limiting: bans for 15 minutes (HTTP 429) after 5 consecutive failures, with automatic garbage collection.
- Global burst rate limiting: all IPs combined are limited to 40 req/min for login frequency.
- Interrupts immediately if the request body exceeds 64KB to prevent stream-based OOM DoS.
- CSRF and Cross-Site WebSocket Hijacking (CSWSH) protection based on strict hostname matching.
UI and Multi-tab Sync¶
- Follows the DSH design system (
--dsw-*CSS tokens, fish logo). - Lock screen is mounted on
document.body(z-index: 2147483647) with a background blur to prevent click-through. - Real-time multi-tab state synchronization based on
BroadcastChannel.
Installation and Enablement¶
Three official methods are provided.
Method 1: DSH CLI (Recommended in README)
dsh plugin --profile web add github:lijx122/dsh-plugin-auth-guard
Method 2: DSH Web Marketplace: Go to Settings → Plugins → Marketplace in the DSH Web GUI, search for auth-guard, and click Install.
Method 3: Local Link (Developer Mode)
- Clone the repository to
~/.dsh/plugins/dsh-plugin-auth-guard; - Add the following to the
dependenciesin~/.dsh/profiles/web/package.json:
{
"dependencies": {
"dsh-plugin-auth-guard": "link:../../plugins/dsh-plugin-auth-guard"
}
}
- Append
dsh-plugin-auth-guardtodsh.profile.bundles, then restart DSH.
Configuration Entry¶
After installation, go to Settings → Security & Access. There are four main configurations:
- Require password for LAN/Remote access: Enforce password for non-localhost sources (default enabled).
- Enforce authentication globally: Force authentication for
127.0.0.1(optional). - Administrator Credentials: Set or modify administrator username and password (password must be at least 6 characters).
- Active LAN IP Directory: Real-time list of all listening LAN addresses, supports one-click copy.
The default strategy is to enforce password authentication only for non-localhost sources; if local access also requires authentication, the global authentication option must be enabled.
Reverse Proxy Deployment¶
The README contains a section titled “5 Essential Reverse Proxy Settings” which provides 5 settings for Nginx / Caddy / Cloudflare deployment. The first item is to increase Nginx’s client_max_body_size: Nginx defaults to 1MB and will reject image and file uploads with 413. Please refer to the corresponding section in the repository README for the remaining settings.
Applicable Scenarios and Notes¶
Suitable for:
- Developers who need to access DSH Web GUI on mobile/tablets via the LAN.
- Scenarios where DSH is deployed on cloud servers requiring public internet access.
- Teams in LAN environments that are not fully trusted or want to default-deny unauthenticated requests.
Notes:
- The plugin defaults to blocking non-localhost sources;
127.0.0.1requires manual enablement of global authentication. - Password must be at least 6 characters; all issued tokens become invalid immediately after changing the password, and active remote terminal connections are also terminated.
- The plugin runs with the permissions of the current dsh process; it is recommended to check the source code and license before installation (this project is MIT).
- Runtime environment requires Node.js >= 20.
Conclusion¶
To recap: Exposing DSH to the LAN or public internet requires solving authentication, anti-spoofing, rate limiting, and mobile compatibility. dsh-plugin-auth-guard packages these into a directly installable bundle and acts as a safety net using a default-deny approach at the TCP layer.
- Repository: https://github.com/lijx122/dsh-plugin-auth-guard
- Community Directory: https://www.skillhub.cn/plugins/lijx122/dsh-plugin-auth-guard (The directory is an independent community site with no official affiliation to DeepSeek / Hypothesis)