Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(plugins): clear dev-host lint regressions

t8y290d1d94a04e6
diff --git a/plugins/sdk/dev-host/server.mjs b/plugins/sdk/dev-host/server.mjs
index 9936e73093..c9b2f9d69b 100644
--- a/plugins/sdk/dev-host/server.mjs
+++ b/plugins/sdk/dev-host/server.mjs
@@ -14,6 +14,10 @@ const BRIDGE_LIMIT = 2 * 1024 * 1024,
UI_BINARY_LIMIT = 8 * 1024 * 1024,
STORAGE_VALUE_LIMIT = 256 * 1024,
STORAGE_TOTAL_LIMIT = 1024 * 1024;
+function hasControlChars(value) {
+ for (let i = 0; i < value.length; i++) if (value.charCodeAt(i) < 0x20) return true;
+ return false;
+}
function jsonSize(value) {
return Buffer.byteLength(JSON.stringify(value) ?? "null");
}
@@ -271,7 +275,7 @@ export async function createMockHost(options) {
case "host.storageSet":
case "host.storageDelete": {
requirePermission(manifest, "host.storage");
- if (typeof p.key !== "string" || !p.key || p.key.length > 256 || /[\u0000-\u001f]/.test(p.key)) throw new Error("storage key is invalid");
+ if (typeof p.key !== "string" || !p.key || p.key.length > 256 || hasControlChars(p.key)) throw new Error("storage key is invalid");
return serialize(async () => {
const entries = await readUiStorage();
if (input.method === "host.storageGet") return entries[p.key] === undefined ? null : structuredClone(entries[p.key]);
diff --git a/plugins/sdk/dev-host/tests/server.test.mjs b/plugins/sdk/dev-host/tests/server.test.mjs
index c07d14039b..79f20c35e2 100644
--- a/plugins/sdk/dev-host/tests/server.test.mjs
+++ b/plugins/sdk/dev-host/tests/server.test.mjs
@@ -372,7 +372,7 @@ test("save, reload, iframe isolation, generic RPC and close lifecycle", async (t
assert.equal(host.sidecar.state, "stopped");
});
test("host.storage persists per-plugin entries behind the declared permission", async (t) => {
- const { root, request } = await fixture(t);
+ const { request } = await fixture(t);
const saved = await request("connections/save", { providerId: "example.connection", values });
const frame = (await request("connections/connect", { id: saved.value.id })).value.frame;
const document = (await request("frame-document", { frameId: frame.id })).value;