@solongate/proxy 0.58.0 → 0.59.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/audit/index.js +0 -0
- package/dist/create.js +0 -0
- package/dist/global-install.js +1 -1
- package/dist/index.js +341 -52
- package/dist/inject.js +0 -0
- package/dist/login.js +5 -39
- package/dist/logs-server.d.ts +1 -0
- package/dist/logs-server.js +174 -0
- package/dist/pull-push.js +0 -0
- package/dist/shield.js +106 -7
- package/hooks/.solongate/.last-deny +1 -0
- package/hooks/.solongate/.last-eval +1 -0
- package/hooks/.solongate/.last-tool-call +1 -0
- package/hooks/audit.mjs +565 -544
- package/hooks/guard.bundled.mjs +21 -2
- package/hooks/guard.mjs +1626 -1604
- package/hooks/shield.mjs +271 -271
- package/hooks/stop.mjs +75 -75
- package/package.json +74 -74
package/hooks/guard.bundled.mjs
CHANGED
|
@@ -6531,7 +6531,7 @@ var init_src = __esm({
|
|
|
6531
6531
|
|
|
6532
6532
|
// hooks/guard.mjs
|
|
6533
6533
|
import { readFileSync, existsSync, statSync, writeFileSync, mkdirSync, chmodSync, renameSync, appendFileSync } from "node:fs";
|
|
6534
|
-
import { resolve, join, dirname } from "node:path";
|
|
6534
|
+
import { resolve, join, dirname, isAbsolute } from "node:path";
|
|
6535
6535
|
import { homedir } from "node:os";
|
|
6536
6536
|
import { gunzipSync } from "node:zlib";
|
|
6537
6537
|
import { createHash } from "node:crypto";
|
|
@@ -6540,12 +6540,31 @@ function localLogsOnly(security) {
|
|
|
6540
6540
|
const l = security && security.localLogs;
|
|
6541
6541
|
return !!(l && l.enabled && typeof l.path === "string" && l.path.trim());
|
|
6542
6542
|
}
|
|
6543
|
+
function resolveLocalLogDir(rawPath) {
|
|
6544
|
+
const dir = String(rawPath || "").trim().replace(/[\\/]+$/, "");
|
|
6545
|
+
if (!dir)
|
|
6546
|
+
return null;
|
|
6547
|
+
if (isAbsolute(dir))
|
|
6548
|
+
return dir;
|
|
6549
|
+
const fallback = resolve(homedir(), ".solongate", "local-logs");
|
|
6550
|
+
try {
|
|
6551
|
+
mkdirSync(resolve(homedir(), ".solongate"), { recursive: true });
|
|
6552
|
+
writeFileSync(
|
|
6553
|
+
resolve(homedir(), ".solongate", ".local-logs-invalid-path"),
|
|
6554
|
+
JSON.stringify({ configured: dir, fallback, ts: Date.now() })
|
|
6555
|
+
);
|
|
6556
|
+
} catch {
|
|
6557
|
+
}
|
|
6558
|
+
return fallback;
|
|
6559
|
+
}
|
|
6543
6560
|
function writeLocalLog(security, entry) {
|
|
6544
6561
|
try {
|
|
6545
6562
|
const l = security && security.localLogs;
|
|
6546
6563
|
if (!l || !l.enabled || typeof l.path !== "string" || !l.path.trim())
|
|
6547
6564
|
return;
|
|
6548
|
-
const dir = l.path
|
|
6565
|
+
const dir = resolveLocalLogDir(l.path);
|
|
6566
|
+
if (!dir)
|
|
6567
|
+
return;
|
|
6549
6568
|
try {
|
|
6550
6569
|
mkdirSync(dir, { recursive: true });
|
|
6551
6570
|
} catch {
|