@goodandready/dsh-ollama-cloud-provider 0.1.34 → 0.1.35
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 +8 -0
- package/lib/client.js +19 -11
- package/lib/index.js +12 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.35 — 2026-11-09
|
|
4
|
+
|
|
5
|
+
- Security: enforce host authentication check (`verifyHost`) across all loopback write routes (`/config`, `/key`), closing unauthenticated mutation bypass on non-desktop browser requests (#111).
|
|
6
|
+
- Security: validate request `Referer` when `Origin` is omitted on GET endpoints to reject cross-origin ambient read requests (#112).
|
|
7
|
+
- Security: validate URL scheme in `OllamaWebFetchProvider.fetch` to reject non-HTTP schemes (`file:`, `ftp:`) and malformed URLs with structured `WebError` (#115).
|
|
8
|
+
- Localization: localized all 11 sampling and generation parameter labels and tokens header in the Chinese dictionary (`const zh`) (#113).
|
|
9
|
+
- Accessibility: added explicit `aria-label` attributes to standalone form controls (model selection checkbox, API key inputs, account credentials, model routing rules, model search) in the settings UI for WCAG 2.1 SC 4.1.2 compliance (#114).
|
|
10
|
+
|
|
3
11
|
## 0.1.34 — 2026-11-07
|
|
4
12
|
|
|
5
13
|
- Security: patched transient zod memory exhaustion vulnerability (GHSA-mrhx-c7xc-m3w5) in dependencies via package overrides, achieving 0 audit vulnerabilities (#108).
|
package/lib/client.js
CHANGED
|
@@ -292,7 +292,7 @@ window.__ModuleLoader__.load({
|
|
|
292
292
|
window: "窗口",
|
|
293
293
|
requests: "请求",
|
|
294
294
|
spend: "费用",
|
|
295
|
-
tokens: "Token",
|
|
295
|
+
tokens: "Token 数",
|
|
296
296
|
spend7d: "7 天费用",
|
|
297
297
|
remaining: "剩余",
|
|
298
298
|
quotaIncludedCredits: "包含额度",
|
|
@@ -424,17 +424,17 @@ window.__ModuleLoader__.load({
|
|
|
424
424
|
no: "否",
|
|
425
425
|
generation: "生成默认值",
|
|
426
426
|
generationHint: "Ollama 原生默认值;空字段不发送,请求参数优先。",
|
|
427
|
-
temperature: "Temperature",
|
|
428
|
-
topK: "Top K",
|
|
429
|
-
topP: "Top P",
|
|
430
|
-
minP: "Min P",
|
|
431
|
-
seed: "Seed",
|
|
432
|
-
repeatPenalty: "Repeat penalty",
|
|
433
|
-
repeatLastN: "Repeat last N",
|
|
434
|
-
numCtx: "num_ctx",
|
|
435
|
-
keepAlive: "Keep
|
|
427
|
+
temperature: "采样温度 (Temperature)",
|
|
428
|
+
topK: "Top K 采样",
|
|
429
|
+
topP: "Top P 采样",
|
|
430
|
+
minP: "Min P 采样",
|
|
431
|
+
seed: "随机种子 (Seed)",
|
|
432
|
+
repeatPenalty: "重复惩罚 (Repeat penalty)",
|
|
433
|
+
repeatLastN: "重复惩罚窗口 (Repeat last N)",
|
|
434
|
+
numCtx: "上下文大小 (num_ctx)",
|
|
435
|
+
keepAlive: "保活时间 (Keep-alive)",
|
|
436
436
|
keepAliveHint: "Ollama keep_alive,例如 5m 或 -1。",
|
|
437
|
-
stop: "Stop sequences",
|
|
437
|
+
stop: "停止序列 (Stop sequences)",
|
|
438
438
|
stopHint: "逗号分隔,作为原生 stop 列表发送。",
|
|
439
439
|
autoRefresh: "自动刷新模型目录",
|
|
440
440
|
refreshMinutes: "刷新间隔(分钟)",
|
|
@@ -2220,6 +2220,7 @@ window.__ModuleLoader__.load({
|
|
|
2220
2220
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2221
2221
|
type: "checkbox",
|
|
2222
2222
|
checked: visible,
|
|
2223
|
+
"aria-label": `${model.id} ${t("visibility")}`,
|
|
2223
2224
|
onChange: (event) => onVisible(event.target.checked)
|
|
2224
2225
|
}),
|
|
2225
2226
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -2550,6 +2551,7 @@ window.__ModuleLoader__.load({
|
|
|
2550
2551
|
className: "ocl-input",
|
|
2551
2552
|
type: "password",
|
|
2552
2553
|
placeholder: t("pasteKey"),
|
|
2554
|
+
"aria-label": t("pasteKey"),
|
|
2553
2555
|
value: keyDraft,
|
|
2554
2556
|
onChange: (event) => setKeyDraft(event.target.value)
|
|
2555
2557
|
}),
|
|
@@ -2753,6 +2755,7 @@ window.__ModuleLoader__.load({
|
|
|
2753
2755
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2754
2756
|
className: "ocl-input",
|
|
2755
2757
|
placeholder: t("accountLabel"),
|
|
2758
|
+
"aria-label": t("accountLabel"),
|
|
2756
2759
|
value: account.label,
|
|
2757
2760
|
onChange: (event) => {
|
|
2758
2761
|
const accounts = draft.accounts.map((entry, position) => position === index ? {
|
|
@@ -2765,6 +2768,7 @@ window.__ModuleLoader__.load({
|
|
|
2765
2768
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2766
2769
|
className: "ocl-input",
|
|
2767
2770
|
placeholder: t("accountRef"),
|
|
2771
|
+
"aria-label": t("accountRef"),
|
|
2768
2772
|
value: account.apiKeyEnv,
|
|
2769
2773
|
onChange: (event) => {
|
|
2770
2774
|
const accounts = draft.accounts.map((entry, position) => position === index ? {
|
|
@@ -2816,6 +2820,7 @@ window.__ModuleLoader__.load({
|
|
|
2816
2820
|
className: "ocl-input",
|
|
2817
2821
|
type: "password",
|
|
2818
2822
|
placeholder: t("pasteKey"),
|
|
2823
|
+
"aria-label": `${t("pasteKey")} (${account.label})`,
|
|
2819
2824
|
value: accountKeys[account.label] ?? "",
|
|
2820
2825
|
onChange: (event) => {
|
|
2821
2826
|
setAccountKeys((current) => ({
|
|
@@ -2918,6 +2923,7 @@ window.__ModuleLoader__.load({
|
|
|
2918
2923
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2919
2924
|
className: "ocl-input",
|
|
2920
2925
|
placeholder: t("rulePattern"),
|
|
2926
|
+
"aria-label": t("rulePattern"),
|
|
2921
2927
|
value: rule.pattern,
|
|
2922
2928
|
onChange: (event) => {
|
|
2923
2929
|
const rules = draft.modelAccountRules.map((entry, position) => position === index ? {
|
|
@@ -2930,6 +2936,7 @@ window.__ModuleLoader__.load({
|
|
|
2930
2936
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2931
2937
|
className: "ocl-input",
|
|
2932
2938
|
placeholder: t("ruleAccount"),
|
|
2939
|
+
"aria-label": t("ruleAccount"),
|
|
2933
2940
|
value: rule.account,
|
|
2934
2941
|
onChange: (event) => {
|
|
2935
2942
|
const rules = draft.modelAccountRules.map((entry, position) => position === index ? {
|
|
@@ -3093,6 +3100,7 @@ window.__ModuleLoader__.load({
|
|
|
3093
3100
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3094
3101
|
className: "ocl-input",
|
|
3095
3102
|
placeholder: t("modelSearch"),
|
|
3103
|
+
"aria-label": t("modelSearch"),
|
|
3096
3104
|
value: search,
|
|
3097
3105
|
onChange: (event) => setSearch(event.target.value)
|
|
3098
3106
|
}),
|
package/lib/index.js
CHANGED
|
@@ -4624,10 +4624,10 @@ function writeSourceError(req) {
|
|
|
4624
4624
|
return sourceHost(referer) === host ? void 0 : "cross-origin request refused";
|
|
4625
4625
|
}
|
|
4626
4626
|
function allowedOrigin(req) {
|
|
4627
|
-
const
|
|
4628
|
-
if (
|
|
4627
|
+
const source = req.headers.origin ?? req.headers.referer;
|
|
4628
|
+
if (source === void 0 || source === "") return true;
|
|
4629
4629
|
try {
|
|
4630
|
-
const parsed = new URL(
|
|
4630
|
+
const parsed = new URL(source);
|
|
4631
4631
|
const host = req.headers.host;
|
|
4632
4632
|
if (host !== void 0 && parsed.host === host) return true;
|
|
4633
4633
|
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1" || parsed.hostname === "[::1]";
|
|
@@ -4664,7 +4664,7 @@ async function readJson(req) {
|
|
|
4664
4664
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error("body must be a JSON object");
|
|
4665
4665
|
return parsed;
|
|
4666
4666
|
}
|
|
4667
|
-
async function requirePost(req, res,
|
|
4667
|
+
async function requirePost(req, res, verifyHost) {
|
|
4668
4668
|
if (req.method !== "POST") {
|
|
4669
4669
|
json(res, 405, { error: "POST required" });
|
|
4670
4670
|
return false;
|
|
@@ -4678,18 +4678,17 @@ async function requirePost(req, res, verifyDesktop) {
|
|
|
4678
4678
|
json(res, 403, { error: "write endpoints are restricted to the local machine" });
|
|
4679
4679
|
return false;
|
|
4680
4680
|
}
|
|
4681
|
-
if (desktopShellRequest(req)) {
|
|
4682
|
-
if (!await verifyDesktop(req)) {
|
|
4683
|
-
json(res, 403, { error: "desktop authentication failed" });
|
|
4684
|
-
return false;
|
|
4685
|
-
}
|
|
4686
|
-
} else {
|
|
4681
|
+
if (!desktopShellRequest(req)) {
|
|
4687
4682
|
const sourceError = writeSourceError(req);
|
|
4688
4683
|
if (sourceError !== void 0) {
|
|
4689
4684
|
json(res, 403, { error: sourceError });
|
|
4690
4685
|
return false;
|
|
4691
4686
|
}
|
|
4692
4687
|
}
|
|
4688
|
+
if (!await verifyHost(req)) {
|
|
4689
|
+
json(res, 403, { error: "authentication required" });
|
|
4690
|
+
return false;
|
|
4691
|
+
}
|
|
4693
4692
|
if (!(req.headers["content-type"] ?? "").includes("application/json")) {
|
|
4694
4693
|
json(res, 415, { error: "application/json required" });
|
|
4695
4694
|
return false;
|
|
@@ -5816,6 +5815,9 @@ var OllamaWebSearchProvider = class extends OllamaWebEndpoint {
|
|
|
5816
5815
|
};
|
|
5817
5816
|
var OllamaWebFetchProvider = class extends OllamaWebEndpoint {
|
|
5818
5817
|
async fetch(request, signal) {
|
|
5818
|
+
if (!URL.canParse(request.url)) throw new WebError("invalid web fetch URL", "INVALID_URL");
|
|
5819
|
+
const parsed = new URL(request.url);
|
|
5820
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new WebError("only http: and https: protocols are supported for web fetch", "UNSUPPORTED_PROTOCOL");
|
|
5819
5821
|
const { status, body } = await postJson(this.options, "/api/web_fetch", { url: request.url }, signal);
|
|
5820
5822
|
const decoded = decodeFetchResponse(body);
|
|
5821
5823
|
return {
|