@cerefox/memory 1.19.6 → 1.21.0
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/dist/bin/cerefox.js +74 -11
- package/dist/frontend/assets/Courier-BRJ-B_ND.js +1370 -0
- package/dist/frontend/assets/Courier-BRJ-B_ND.js.map +1 -0
- package/dist/frontend/assets/docx-DeQjAnSd.js +29 -0
- package/dist/frontend/assets/docx-DeQjAnSd.js.map +1 -0
- package/dist/frontend/assets/index-CV1iy1p2.css +1 -0
- package/dist/frontend/assets/index-Dd1nIOAB.js +122 -0
- package/dist/frontend/assets/index-Dd1nIOAB.js.map +1 -0
- package/dist/frontend/assets/markdown-CsTKTR78.js +2 -0
- package/dist/frontend/assets/markdown-CsTKTR78.js.map +1 -0
- package/dist/frontend/assets/pdf-CkRjSAWX.js +7 -0
- package/dist/frontend/assets/pdf-CkRjSAWX.js.map +1 -0
- package/dist/frontend/assets/pdfmake-L7DGtDcB.js +229 -0
- package/dist/frontend/assets/pdfmake-L7DGtDcB.js.map +1 -0
- package/dist/frontend/assets/rolldown-runtime-COiEfhsA.js +1 -0
- package/dist/frontend/assets/vfs_fonts-D9BViC6C.js +2 -0
- package/dist/frontend/assets/vfs_fonts-D9BViC6C.js.map +1 -0
- package/dist/frontend/index.html +3 -2
- package/dist/server-assets/_shared/ef-meta/index.ts +2 -2
- package/docs/guides/configuration.md +1 -0
- package/docs/guides/securing-local-access.md +54 -8
- package/docs/guides/setup-cloud-run.md +47 -10
- package/docs/guides/setup-lan.md +220 -0
- package/docs/guides/setup-local.md +4 -0
- package/package.json +2 -2
- package/dist/frontend/assets/index-01k5C3sG.css +0 -1
- package/dist/frontend/assets/index-lS0yMSGS.js +0 -121
- package/dist/frontend/assets/index-lS0yMSGS.js.map +0 -1
package/dist/bin/cerefox.js
CHANGED
|
@@ -5318,7 +5318,7 @@ var init_cli_core = __esm(() => {
|
|
|
5318
5318
|
});
|
|
5319
5319
|
|
|
5320
5320
|
// src/meta.ts
|
|
5321
|
-
var PKG_VERSION = "1.
|
|
5321
|
+
var PKG_VERSION = "1.21.0";
|
|
5322
5322
|
var init_meta = () => {};
|
|
5323
5323
|
|
|
5324
5324
|
// ../../_shared/config/paths.ts
|
|
@@ -26567,15 +26567,15 @@ function decideAuth(input) {
|
|
|
26567
26567
|
const keys = input.configuredKeys.trim();
|
|
26568
26568
|
if (!keys)
|
|
26569
26569
|
return { allow: true, reason: "disabled" };
|
|
26570
|
-
const local = isLoopbackAddress(input.remoteAddress);
|
|
26571
|
-
if (local && !input.requireKeyEverywhere) {
|
|
26572
|
-
return { allow: true, reason: "loopback" };
|
|
26573
|
-
}
|
|
26574
26570
|
const result = checkAccessToken(input.authorization, {
|
|
26575
26571
|
tokens: parseAccessTokens(keys)
|
|
26576
26572
|
});
|
|
26577
26573
|
if (result.ok)
|
|
26578
26574
|
return { allow: true, reason: "valid_key" };
|
|
26575
|
+
const local = isLoopbackAddress(input.remoteAddress);
|
|
26576
|
+
if (local && !input.requireKeyEverywhere) {
|
|
26577
|
+
return { allow: true, reason: "loopback" };
|
|
26578
|
+
}
|
|
26579
26579
|
if (result.reason === "no_token") {
|
|
26580
26580
|
return {
|
|
26581
26581
|
allow: false,
|
|
@@ -26589,6 +26589,49 @@ function decideAuth(input) {
|
|
|
26589
26589
|
message: "The API key presented is not valid for this server."
|
|
26590
26590
|
};
|
|
26591
26591
|
}
|
|
26592
|
+
function hostnameOf(hostHeader) {
|
|
26593
|
+
const h = hostHeader.trim().toLowerCase();
|
|
26594
|
+
if (h.startsWith("[")) {
|
|
26595
|
+
const end = h.indexOf("]");
|
|
26596
|
+
return end === -1 ? h : h.slice(0, end + 1);
|
|
26597
|
+
}
|
|
26598
|
+
const colon = h.lastIndexOf(":");
|
|
26599
|
+
return colon === -1 ? h : h.slice(0, colon);
|
|
26600
|
+
}
|
|
26601
|
+
function isIpLiteral(hostname) {
|
|
26602
|
+
return /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname) || /^\[[0-9a-f:.]+\]$/.test(hostname);
|
|
26603
|
+
}
|
|
26604
|
+
function browserGuard(input) {
|
|
26605
|
+
if ((input.secFetchSite ?? "").trim().toLowerCase() === "cross-site") {
|
|
26606
|
+
return { allow: false, message: "Refused a cross-site request: a page from another site cannot use this server." };
|
|
26607
|
+
}
|
|
26608
|
+
const host = (input.host ?? "").trim().toLowerCase();
|
|
26609
|
+
if (host) {
|
|
26610
|
+
const name = hostnameOf(host);
|
|
26611
|
+
const extra = input.allowedHosts.split(",").map((h) => h.trim().toLowerCase()).filter(Boolean);
|
|
26612
|
+
if (!SAFE_HOST_NAMES.has(name) && !isIpLiteral(name) && !extra.includes("*") && !extra.includes(name)) {
|
|
26613
|
+
return {
|
|
26614
|
+
allow: false,
|
|
26615
|
+
message: `Refused: this server was reached as "${name}". Without an API key it answers only to ` + "an IP address or localhost, so a web page cannot re-point its own name at it. If you " + "use this name on purpose, add it to CEREFOX_ALLOWED_HOSTS, or turn the API key on."
|
|
26616
|
+
};
|
|
26617
|
+
}
|
|
26618
|
+
}
|
|
26619
|
+
const origin = input.origin?.trim();
|
|
26620
|
+
if (origin) {
|
|
26621
|
+
let originHost = null;
|
|
26622
|
+
try {
|
|
26623
|
+
originHost = new URL(origin).host.toLowerCase();
|
|
26624
|
+
} catch {
|
|
26625
|
+
originHost = null;
|
|
26626
|
+
}
|
|
26627
|
+
const sameAsHost = originHost !== null && originHost === host;
|
|
26628
|
+
const fromThisMachine = originHost !== null && LOCAL_HOST_NAMES.has(hostnameOf(originHost));
|
|
26629
|
+
if (!sameAsHost && !fromThisMachine) {
|
|
26630
|
+
return { allow: false, message: `Refused a request from the page at ${origin}: a page from another site cannot use this server.` };
|
|
26631
|
+
}
|
|
26632
|
+
}
|
|
26633
|
+
return { allow: true };
|
|
26634
|
+
}
|
|
26592
26635
|
function restGatewayKeys(env = process.env) {
|
|
26593
26636
|
const keys = env.CEREFOX_API_KEY ?? "";
|
|
26594
26637
|
if (!keys.trim() || !(env.CEREFOX_POSTGREST_UPSTREAM ?? "").trim())
|
|
@@ -26604,8 +26647,19 @@ function apiAuth(keys = () => process.env.CEREFOX_API_KEY ?? "") {
|
|
|
26604
26647
|
configuredKeys: keys(),
|
|
26605
26648
|
requireKeyEverywhere: (process.env.CEREFOX_API_REQUIRE_KEY ?? "") === "1"
|
|
26606
26649
|
});
|
|
26607
|
-
if (decision.allow)
|
|
26650
|
+
if (decision.allow) {
|
|
26651
|
+
if (decision.reason !== "valid_key") {
|
|
26652
|
+
const guard = browserGuard({
|
|
26653
|
+
host: c.req.header("Host") ?? null,
|
|
26654
|
+
origin: c.req.header("Origin") ?? null,
|
|
26655
|
+
secFetchSite: c.req.header("Sec-Fetch-Site") ?? null,
|
|
26656
|
+
allowedHosts: process.env.CEREFOX_ALLOWED_HOSTS ?? ""
|
|
26657
|
+
});
|
|
26658
|
+
if (!guard.allow)
|
|
26659
|
+
return c.json({ detail: guard.message }, 403);
|
|
26660
|
+
}
|
|
26608
26661
|
return next();
|
|
26662
|
+
}
|
|
26609
26663
|
return c.json({ detail: decision.message }, 401, {
|
|
26610
26664
|
"WWW-Authenticate": 'Bearer realm="cerefox"'
|
|
26611
26665
|
});
|
|
@@ -26618,7 +26672,7 @@ function remoteAddressOf(c) {
|
|
|
26618
26672
|
return;
|
|
26619
26673
|
}
|
|
26620
26674
|
}
|
|
26621
|
-
var API_KEY_PREFIX = "cfx_lak_", LOOPBACK_ADDRESSES;
|
|
26675
|
+
var API_KEY_PREFIX = "cfx_lak_", LOOPBACK_ADDRESSES, LOCAL_HOST_NAMES, SAFE_HOST_NAMES;
|
|
26622
26676
|
var init_auth = __esm(() => {
|
|
26623
26677
|
init_conninfo();
|
|
26624
26678
|
init_ef_auth();
|
|
@@ -26627,6 +26681,8 @@ var init_auth = __esm(() => {
|
|
|
26627
26681
|
"::1",
|
|
26628
26682
|
"::ffff:127.0.0.1"
|
|
26629
26683
|
]);
|
|
26684
|
+
LOCAL_HOST_NAMES = new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
26685
|
+
SAFE_HOST_NAMES = new Set([...LOCAL_HOST_NAMES, "host.docker.internal"]);
|
|
26630
26686
|
});
|
|
26631
26687
|
|
|
26632
26688
|
// src/web/daemon.ts
|
|
@@ -26902,7 +26958,7 @@ var init_update_check = __esm(() => {
|
|
|
26902
26958
|
});
|
|
26903
26959
|
|
|
26904
26960
|
// ../../_shared/ef-meta/index.ts
|
|
26905
|
-
var EF_VERSION = "1.
|
|
26961
|
+
var EF_VERSION = "1.21.0", CEREFOX_VERSION = "1.21.0", EF_LAST_CHANGED = "1.19.0";
|
|
26906
26962
|
var init_ef_meta = () => {};
|
|
26907
26963
|
|
|
26908
26964
|
// ../../_shared/embeddings/onnx-embedder.ts
|
|
@@ -68423,10 +68479,16 @@ async function applyRpcs(opts) {
|
|
|
68423
68479
|
}
|
|
68424
68480
|
}
|
|
68425
68481
|
|
|
68482
|
+
// src/cli/util/npx-env.ts
|
|
68483
|
+
function nestedNpxEnv(env = process.env) {
|
|
68484
|
+
const { npm_config_package: _leaked, ...rest } = env;
|
|
68485
|
+
return rest;
|
|
68486
|
+
}
|
|
68487
|
+
|
|
68426
68488
|
// src/cli/commands/deploy-server.ts
|
|
68427
68489
|
function commandSucceeds(cmd, args) {
|
|
68428
68490
|
try {
|
|
68429
|
-
const r = spawnSync2(cmd, args, { encoding: "utf8", timeout: 15000 });
|
|
68491
|
+
const r = spawnSync2(cmd, args, { encoding: "utf8", timeout: 15000, env: nestedNpxEnv() });
|
|
68430
68492
|
return r.status === 0;
|
|
68431
68493
|
} catch {
|
|
68432
68494
|
return false;
|
|
@@ -68633,7 +68695,8 @@ Proceed with deployment to Supabase?`, true);
|
|
|
68633
68695
|
encoding: "utf8",
|
|
68634
68696
|
stdio: ["inherit", "pipe", "pipe"],
|
|
68635
68697
|
cwd: workdir,
|
|
68636
|
-
timeout: 120000
|
|
68698
|
+
timeout: 120000,
|
|
68699
|
+
env: nestedNpxEnv()
|
|
68637
68700
|
});
|
|
68638
68701
|
if (r.stdout)
|
|
68639
68702
|
process.stdout.write(r.stdout);
|
|
@@ -76591,7 +76654,7 @@ function setSecret(setValue, projectRef, dryRun) {
|
|
|
76591
76654
|
println(c.dim(` (dry-run) npx supabase secrets set ${SECRET_NAME}=${shown}` + (projectRef ? ` --project-ref ${projectRef}` : "")));
|
|
76592
76655
|
return;
|
|
76593
76656
|
}
|
|
76594
|
-
const r = spawnSync7("npx", args, { encoding: "utf8", stdio: "inherit" });
|
|
76657
|
+
const r = spawnSync7("npx", args, { encoding: "utf8", stdio: "inherit", env: nestedNpxEnv() });
|
|
76595
76658
|
if (r.status !== 0) {
|
|
76596
76659
|
throw userError(`Failed to set the ${SECRET_NAME} Function secret.`, "Install the Supabase CLI and link the project (or pass --project-ref <ref>).");
|
|
76597
76660
|
}
|