@goodandready/dsh-ollama-cloud-provider 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh.md +4 -4
- package/lib/index.js +53 -6
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.30 — 2026-11-05
|
|
4
|
+
|
|
5
|
+
- Security: credential writes now accept only the configured default/account
|
|
6
|
+
refs; the allowlist no longer falls through to every `OLLAMA_*` name.
|
|
7
|
+
- Security: private-read host verification uses the local socket origin instead
|
|
8
|
+
of the request Host and rejects a public 404 probe, closing DNS-rebinding
|
|
9
|
+
cookie/SSRF exposure while preserving DSH's authenticated-404 behavior.
|
|
10
|
+
- Security: unsaved-endpoint discovery now requires HTTPS and rejects
|
|
11
|
+
loopback/link-local/private/reserved addresses; test-only private targets are
|
|
12
|
+
explicit.
|
|
13
|
+
- Build: declared `react-dom` and `@types/react-dom`; clean `npm ci` now passes
|
|
14
|
+
the full test/build gate. Added host-verification coverage; 132/132.
|
|
15
|
+
|
|
3
16
|
## 0.1.29 — 2026-11-05
|
|
4
17
|
|
|
5
18
|
- Made the plugin cloud-only. Removed the local endpoint mode, local model
|
package/README.md
CHANGED
|
@@ -121,17 +121,17 @@ npm pack
|
|
|
121
121
|
Install the published package:
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
124
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.30
|
|
125
125
|
# DSH Desktop:
|
|
126
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
126
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.30
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
Or install the packed tarball into a profile:
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
132
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.30.tgz
|
|
133
133
|
# DSH Desktop:
|
|
134
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
134
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.30.tgz
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
|
package/README.ru.md
CHANGED
|
@@ -103,17 +103,17 @@ npm pack
|
|
|
103
103
|
Установка опубликованного пакета из npm:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
106
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.30
|
|
107
107
|
# DSH Desktop:
|
|
108
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
108
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.30
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
Либо установка из упакованного tarball:
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
114
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.30.tgz
|
|
115
115
|
# DSH Desktop:
|
|
116
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
116
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.30.tgz
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
После установки перезапустите dsh (или DSH Desktop) и выберите **Ollama Cloud** в списке моделей.
|
package/README.zh.md
CHANGED
|
@@ -102,17 +102,17 @@ npm pack
|
|
|
102
102
|
从 npm 安装已发布版本:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
105
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.30
|
|
106
106
|
# DSH 桌面端:
|
|
107
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
107
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.30
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
或通过打包文件安装:
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
113
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.30.tgz
|
|
114
114
|
# DSH 桌面端:
|
|
115
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
115
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.30.tgz
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
|
package/lib/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import { credentialRef } from "@deepseek-ai/dsh-credentials";
|
|
|
9
9
|
import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
|
|
10
10
|
import { spawn } from "node:child_process";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { lookup } from "node:dns/promises";
|
|
13
|
+
import { isIP } from "node:net";
|
|
12
14
|
import { WebError } from "@deepseek-ai/dsh-web";
|
|
13
15
|
// src/account-rules.ts
|
|
14
16
|
function glob(pattern) {
|
|
@@ -122,7 +124,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
|
|
|
122
124
|
const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
|
|
123
125
|
const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
|
|
124
126
|
const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
|
|
125
|
-
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.
|
|
127
|
+
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.30";
|
|
126
128
|
const DEFAULT_CONTEXT_WINDOW = 131072;
|
|
127
129
|
const DEFAULT_MAX_TOKENS = 32768;
|
|
128
130
|
const DEFAULT_GENERATE_MAX_TOKENS = 131072;
|
|
@@ -4230,6 +4232,36 @@ function normalizeBase(raw) {
|
|
|
4230
4232
|
if (url.username !== "" || url.password !== "") throw new DiscoveryError("endpoint URL must not contain credentials");
|
|
4231
4233
|
return sanitizeUrl(value);
|
|
4232
4234
|
}
|
|
4235
|
+
function isPrivateV4(address) {
|
|
4236
|
+
const parts = address.split(".").map(Number);
|
|
4237
|
+
if (parts.length !== 4 || parts.some((part) => !Number.isInteger(part) || part < 0 || part > 255)) return true;
|
|
4238
|
+
const [a, b] = parts;
|
|
4239
|
+
return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 192 && b === 0 || a === 198 && (b === 18 || b === 19) || a >= 224;
|
|
4240
|
+
}
|
|
4241
|
+
function isPrivateAddress(address) {
|
|
4242
|
+
const clean = address.toLowerCase().replace(/^\[|\]$/g, "");
|
|
4243
|
+
if (isIP(clean) === 4) return isPrivateV4(clean);
|
|
4244
|
+
if (isIP(clean) !== 6) return true;
|
|
4245
|
+
return clean === "::1" || clean === "::" || clean.startsWith("fc") || clean.startsWith("fd") || /^fe[89ab]/.test(clean) || clean.startsWith("ff") || clean.startsWith("2001:db8") || clean.startsWith("::ffff:");
|
|
4246
|
+
}
|
|
4247
|
+
async function assertPublicEndpoint(base, options) {
|
|
4248
|
+
if (options.allowPrivate === true) return;
|
|
4249
|
+
const url = new URL(base);
|
|
4250
|
+
if (url.protocol !== "https:") throw new DiscoveryError("endpoint must use https");
|
|
4251
|
+
const host = url.hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
4252
|
+
if (host === "localhost" || host.endsWith(".localhost")) throw new DiscoveryError("private endpoint refused");
|
|
4253
|
+
let addresses;
|
|
4254
|
+
if (isIP(host) !== 0) addresses = [host];
|
|
4255
|
+
else try {
|
|
4256
|
+
addresses = (await lookup(host, {
|
|
4257
|
+
all: true,
|
|
4258
|
+
verbatim: true
|
|
4259
|
+
})).map((entry) => entry.address);
|
|
4260
|
+
} catch {
|
|
4261
|
+
throw new DiscoveryError("could not resolve endpoint");
|
|
4262
|
+
}
|
|
4263
|
+
if (addresses.length === 0 || addresses.some(isPrivateAddress)) throw new DiscoveryError("private endpoint refused");
|
|
4264
|
+
}
|
|
4233
4265
|
function idsOf(payload) {
|
|
4234
4266
|
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return [];
|
|
4235
4267
|
const record = payload;
|
|
@@ -4263,8 +4295,9 @@ async function get(url, key, fetchImpl, signal) {
|
|
|
4263
4295
|
* Discover a catalog for an unsaved endpoint with a one-shot key.
|
|
4264
4296
|
* This function performs no persistence and never includes the key in errors.
|
|
4265
4297
|
*/
|
|
4266
|
-
async function discoverModels(rawBase, key, fetchImpl = fetch) {
|
|
4298
|
+
async function discoverModels(rawBase, key, fetchImpl = fetch, options = {}) {
|
|
4267
4299
|
const base = normalizeBase(rawBase);
|
|
4300
|
+
await assertPublicEndpoint(base, options);
|
|
4268
4301
|
const budget = AbortSignal.timeout(DISCOVERY_TIMEOUT_MS);
|
|
4269
4302
|
let payload;
|
|
4270
4303
|
try {
|
|
@@ -4528,12 +4561,17 @@ function desktopShellRequest(req) {
|
|
|
4528
4561
|
const cookie = req.headers.cookie ?? "";
|
|
4529
4562
|
return agent.includes("@deepseek-ai/dsh-desktop/") && cookie.includes("dsh-auth-");
|
|
4530
4563
|
}
|
|
4564
|
+
function localVerificationOrigin(req) {
|
|
4565
|
+
const port = req.socket.localPort;
|
|
4566
|
+
if (port === void 0 || port <= 0) return void 0;
|
|
4567
|
+
return `${req.socket.encrypted === true ? "https" : "http"}://127.0.0.1:${port}`;
|
|
4568
|
+
}
|
|
4531
4569
|
async function defaultVerifyHost(req) {
|
|
4532
|
-
const
|
|
4570
|
+
const localOrigin = localVerificationOrigin(req);
|
|
4533
4571
|
const cookie = req.headers.cookie;
|
|
4534
|
-
if (
|
|
4572
|
+
if (localOrigin === void 0 || cookie === void 0 || cookie === "") return false;
|
|
4535
4573
|
try {
|
|
4536
|
-
const response = await fetch(
|
|
4574
|
+
const response = await fetch(`${localOrigin}/api/version`, {
|
|
4537
4575
|
headers: {
|
|
4538
4576
|
cookie,
|
|
4539
4577
|
accept: "application/json"
|
|
@@ -4543,6 +4581,15 @@ async function defaultVerifyHost(req) {
|
|
|
4543
4581
|
});
|
|
4544
4582
|
await response.body?.cancel();
|
|
4545
4583
|
if (response.status >= 300 && response.status < 400) return false;
|
|
4584
|
+
if (response.status === 404) {
|
|
4585
|
+
const anonymous = await fetch(`${localOrigin}/api/version`, {
|
|
4586
|
+
headers: { accept: "application/json" },
|
|
4587
|
+
redirect: "manual",
|
|
4588
|
+
signal: AbortSignal.timeout(2500)
|
|
4589
|
+
});
|
|
4590
|
+
await anonymous.body?.cancel();
|
|
4591
|
+
return anonymous.status === 401 || anonymous.status === 403;
|
|
4592
|
+
}
|
|
4546
4593
|
return response.status < 500 && response.status !== 401 && response.status !== 403;
|
|
4547
4594
|
} catch {
|
|
4548
4595
|
return false;
|
|
@@ -4658,7 +4705,7 @@ function canWriteCredentialRef(config, ref) {
|
|
|
4658
4705
|
if (!isCredentialRef(ref)) return false;
|
|
4659
4706
|
if (ref === config.apiKeyEnv) return true;
|
|
4660
4707
|
for (const account of config.accounts) if (typeof account.apiKeyEnv === "string" && account.apiKeyEnv.trim() === ref) return true;
|
|
4661
|
-
return
|
|
4708
|
+
return false;
|
|
4662
4709
|
}
|
|
4663
4710
|
function configOps(patch) {
|
|
4664
4711
|
const ops = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-ollama-cloud-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "Ollama Cloud LLM provider plugin for DeepSeek Harness (dsh).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"build": "tsdown",
|
|
74
74
|
"prepare": "tsdown 1>&2",
|
|
75
75
|
"typecheck": "tsc --noEmit",
|
|
76
|
-
"test": "node --import tsx --test tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.test.ts tests/openai-chat.test.ts tests/commands.test.ts tests/tui-settings.test.ts tests/analytics.test.ts tests/apply.test.ts tests/account-rules.test.ts tests/request-log.test.ts tests/image-budget.test.ts tests/tool-schema.test.ts tests/tools.test.ts tests/plugin-updater.test.ts tests/compat.test.ts tests/status.test.ts tests/settings-draft.test.ts tests/update-state.test.ts tests/ui-render.test.tsx tests/update-card-view.test.tsx tests/web.test.ts tests/mock-ollama.test.ts tests/reasoning.test.ts tests/catalog-cache.test.ts tests/attempt.test.ts tests/model-groups.test.tsx tests/discovery.test.ts tests/sanitize.test.ts tests/retry.test.ts tests/provider-card.test.tsx",
|
|
76
|
+
"test": "node --import tsx --test tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.test.ts tests/openai-chat.test.ts tests/commands.test.ts tests/tui-settings.test.ts tests/analytics.test.ts tests/apply.test.ts tests/account-rules.test.ts tests/request-log.test.ts tests/image-budget.test.ts tests/tool-schema.test.ts tests/tools.test.ts tests/plugin-updater.test.ts tests/compat.test.ts tests/status.test.ts tests/settings-draft.test.ts tests/update-state.test.ts tests/ui-render.test.tsx tests/update-card-view.test.tsx tests/web.test.ts tests/mock-ollama.test.ts tests/reasoning.test.ts tests/catalog-cache.test.ts tests/attempt.test.ts tests/model-groups.test.tsx tests/discovery.test.ts tests/sanitize.test.ts tests/retry.test.ts tests/provider-card.test.tsx tests/host-verification.test.ts",
|
|
77
77
|
"check": "npm run typecheck && npm test && npm run build",
|
|
78
78
|
"release": "npm run check && npm pack",
|
|
79
79
|
"sync:models": "node scripts/sync-models.mjs"
|
|
@@ -120,7 +120,9 @@
|
|
|
120
120
|
"@deepseek-ai/schemastery": "~3.19.0",
|
|
121
121
|
"@types/node": "^22.0.0",
|
|
122
122
|
"@types/react": "^18.3.1",
|
|
123
|
+
"@types/react-dom": "18.3.7",
|
|
123
124
|
"react": "^18.3.1",
|
|
125
|
+
"react-dom": "18.3.1",
|
|
124
126
|
"tsdown": "^0.22.2",
|
|
125
127
|
"tsx": "^4.23.12",
|
|
126
128
|
"typescript": "^5.7.2"
|