daifuyang/dsh-plugin--plugins-auth ↗★ 0
dsh-auth-plugin
Optional auth layer for dsh: login overlay for the Web GUI and /login, /logout, /whoami commands + a tools/pre-execute permission gate (POC).
AI 분석
核心用途是为 DSH 网页端添加密码登录墙,并对敏感工具的执行进行权限拦截。适合将 DSH 部署在公网或多用户共享环境、需要安全防护的用户。
설치
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:daifuyang/dsh-plugin#a30db42814421e890a822f58dcc2c8ecb5ca94dd&path:plugins/authdsh-auth-plugin
Optional auth layer for dsh, packaged as a bundle per the publish tutorial.
Two halves, independent by design:
-
Browser wall: a server-side prefix route on
/covers any visitor without a session cookie. The SPA HTML is served either way, but the page renders a Vercel-style login card injected right after `` when the cookie is absent. The user stays on the same URL (e.g./sessions/abc) — there is no abrupt redirect to a separate/loginpage. Submitting the form posts to/auth/login; on success the server sets an HttpOnly cookie and the next navigation drops the overlay. -
Agent gate:
/login,/logout, and/whoamislash commands track per-Session auth state. Atools/pre-executewaterfall turns non-public tool calls into anaskdecision until the Session is logged in. Public tools (read_file,list_directory,web_search,web_fetch) are always allowed without login.
The browser cookie and the agent Session state are deliberately separate: a logged-in browser does not log the agent in, and vice versa.
Install
pnpm dsh plugin --profile add ./plugins/auth
pnpm dsh --profile
Config
- id: auth
name: dsh-auth-plugin
config:
requireLogin: true # default; set false to disable the agent-side gate
Credential policy
The expected username and password are resolved per request from the
credentials seam ($DSH_HOME/.credentials.yaml, then the process
environment). When neither source supplies a value, the POC defaults
dfy / 123456 are accepted. Harden by setting:
DSH_AUTH_USER=alice DSH_AUTH_PASSWORD='s3cret' pnpm dsh web
Known limitations and deferred work
- Auth state is per-
Session, not global; logging into one agent does not log into its subagents. - Browser cookie store is in-memory (
Set), so a dsh restart logs everyone out. Persist to disk if you need that. - No CSRF token on
/auth/login— the form accepts a same-origin POST and cookies areSameSite=Strict, but add a token if you ever expose this beyond loopback. - No
/logout --allcross-session sweep yet. - SPA dist resolution depends on
apps/web/dist/index.htmlbeing reachable from the bundle's real path — works in source-checkout; for installed distributions, publish a versioned@deepseek-ai/dsh-web-frontendsorequire.resolvefinds it.