Introduction¶
DeepSeek Harness (DSH) opened the connection.authentication hook in version 0.2.3, allowing plugins to take over the login flow. Previously, implementing SSO at the reverse proxy layer (e.g., oauth2-proxy, Caddy’s import protected) required multiple processes to share secrets, managing extra containers, and decoupled TLS termination from login logic. dsh-oauth, as a DSH bundle, integrates the login wall directly into the application, enabling sign-in with existing accounts right inside the DSH Web interface.
Plugin Overview¶
- Name: dsh-oauth
- Maintainer: DSHJJJ
- Category: admin-security
- Repository: https://github.com/DSHJJJ/dsh-oauth
- Description: Provides OAuth/OIDC login for DeepSeek Harness Web. Ships with nine built-in providers—GitHub, Google, GitLab, Gitee, Microsoft Entra, Discord, Slack, Keycloak/any OIDC, and Feishu/Lark. Configure via Settings → OAuth. No restart required, no environment variables, no YAML.
Installation & Activation¶
Run the following on your DSH host:
dsh plugin --profile web add @dshj/dsh-oauth
After installation, the plugin inserts an oauth-github configuration entry, and a dedicated OAuth settings panel appears on the Settings page. If the profile loader prompts a restart, restart once; all subsequent configuration changes take effect immediately.
Adding a Login Provider¶
- Create an OAuth application on the target platform and obtain the Client ID and Client Secret.
- In DSH, navigate to Settings → OAuth → Add an OAuth provider, select the provider, fill in Client ID, Client Secret, and Allowed accounts (optional), and complete any additional fields required by the platform.
- Once saved, the provider appears on the login page immediately; accounts on the allowlist can sign in.
Allowed accounts accept the identity identifiers returned by the provider (e.g., GitHub login, email, Google sub, Feishu open_id, etc.), case-insensitive. Leaving it empty denies all logins (fail-closed default).
Built-in Providers¶
| Provider | Extra Fields | Identity Candidate Fields |
|---|---|---|
| GitHub | – | login, numeric id, email |
| – | sub, email | |
| GitLab | base URL | username, id, email |
| Gitee | – | login, id, email |
| Microsoft | tenant | sub, email, preferred_username |
| Discord | – | username, id, email |
| Slack | – | sub, email |
| Feishu / Lark | edition, scope | open_id, union_id, user_id, email, enterprise_email |
| Keycloak / OIDC | issuer (discovery) | sub, email, preferred_username |
Native local token/device pairing login remains available: the OAuth flow is only triggered when a provider is enabled and that provider accepts the request.
Workflow¶
GET /oauth/<provider>/startgenerates a 256-bit state, binds it to the provider, with a 10-minute TTL and single-use enforcement.- The provider redirects back to
/oauth/<provider>/callback; the server completes the token exchange, fetches the user profile, and maps it to{ id, name, identifiers[] }. - The allowlist is checked; upon success, the browser receives a
dsh_oauth_sessionCookie: HttpOnly, SameSite=Lax, Secure if the public URL is HTTPS, signed with HMAC-SHA256. - Subsequent requests check the enabled list and allowlist in real time: disabling a provider or modifying the allowlist immediately affects existing sessions.
No server-side session table is used. The Cookie carries the provider identifier, subject, identifiers, and absolute expiration; third-party access tokens are used solely for the userinfo request and then discarded.
Hot-Configuration Effects¶
| Action | Effect |
|---|---|
| Add a provider | Appears on the login page on the next request |
| Edit the allowlist | Removed accounts are denied on their next request |
| Delete/disable a provider | Sessions for that provider are immediately invalidated |
Rotate $DSH_HOME/oauth-github/secret |
All OAuth sessions are invalidated |
Feishu/Lark Extra Features¶
- Create an application via QR-code scan: uses the RFC 8628 device flow from the Feishu CLI/SDK to auto-create the app.
- Configuration pre-check: verifies
tenant_access_token, whether the redirect URL is accepted by the authorization page (error code 20029), and whetherapplication:application:patchpermits registering a redirect URL via the Open Platform API. If the API is unavailable, the manifest prints exact manual steps.
Redirect URL changes take effect immediately; other app configuration changes may require a version release.
Extending with Custom Providers¶
Append an entry to the CATALOG in src/catalog.ts:
example: {
label: 'Example',
description: 'Example OAuth service.',
docsUrl: 'https://example.com/apps',
scope: 'openid profile',
fields: [{ key: 'region', label: 'Region', type: 'text', default: 'us' }],
token: { body: 'form' },
endpoints: (config) => ({
authorizeUrl: `https://${config.region}.example.com/oauth/authorize`,
tokenUrl: `https://${config.region}.example.com/oauth/token`,
userInfoUrl: `https://${config.region}.example.com/oauth/userinfo`,
}),
profile: (user) => ({
id: String(user.sub),
name: String(user.name ?? user.sub),
identifiers: [user.sub, user.email].filter(Boolean).map(String),
}),
},
The Settings page renders a form based on fields, the login page lists the provider, and the engine handles state, token exchange, userinfo, allowlist, and Cookie.
Security & Storage¶
state: 256-bit, single-use, provider-bound, expires after 10 minutes.- Cookie: HMAC-SHA256 signed, HttpOnly, SameSite=Lax, Secure set based on the public URL scheme.
- Secrets never leak to the browser: the configuration list only reports
hasSecret; omittingclientSecreton write preserves the stored value. - The settings API requires an authenticated owner; cross-site writes are rejected by the harness fence.
- The allowlist is the sole authorization check; each IdP account is treated as one owner credential.
Storage locations:
- Provider configuration:
$DSH_HOME/oauth-github/providers.json(0600, atomic write, contains secrets) - Cookie signing key:
$DSH_HOME/oauth-github/secret(0600, generated once) - Sessions: browser Cookie
dsh_oauth_session
Use Cases & Notes¶
- Ideal for organizations that already use an OAuth/OIDC provider (GitHub, Google, GitLab, Gitee, Microsoft Entra, Discord, Slack, Keycloak, Feishu/Lark, or any other OIDC) and want a unified login entry point with centralized allowlist management.
- The plugin runs with DSH process privileges; review the source code and license (MIT) before installing.
- No longer depends on external oauth2-proxy or Caddy import protection; TLS termination location can remain unchanged.
Summary¶
dsh-oauth integrates OAuth login directly into DeepSeek Harness, leveraging the connection.authentication hook in DSH 0.2.3 to deliver single-configuration, multi-provider, per-account allowlist control. Configuration takes effect immediately—no extra processes, no environment variables—making it well suited for unified login management in the DSH Web environment.
- Plugin directory page: https://www.skillhub.cn/plugins/DSHJJJ/dsh-oauth
- GitHub repository: https://github.com/DSHJJJ/dsh-oauth