@solongate/proxy 0.81.64 → 0.81.65
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.
|
@@ -59,3 +59,4 @@
|
|
|
59
59
|
{"ms":4,"ts":1784374838495,"tool":"Write","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
|
|
60
60
|
{"ms":3,"ts":1784374848281,"tool":"Bash","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
|
|
61
61
|
{"ms":4,"ts":1784375224287,"tool":"Bash","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
|
|
62
|
+
{"ms":5,"ts":1784375813890,"tool":"Bash","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"ms":
|
|
1
|
+
{"ms":5,"ts":1784375813890,"tool":"Bash","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1784375802574
|
package/hooks/guard.bundled.mjs
CHANGED
|
@@ -6536,7 +6536,7 @@ import { resolve, join, dirname, isAbsolute } from "node:path";
|
|
|
6536
6536
|
import { homedir } from "node:os";
|
|
6537
6537
|
import { gunzipSync } from "node:zlib";
|
|
6538
6538
|
import { createHash } from "node:crypto";
|
|
6539
|
-
var HOOK_VERSION =
|
|
6539
|
+
var HOOK_VERSION = 39;
|
|
6540
6540
|
function localLogsOnly(security) {
|
|
6541
6541
|
if (security && typeof security === "object") {
|
|
6542
6542
|
const l = security.localLogs;
|
|
@@ -6557,56 +6557,19 @@ function writeLocalMarker(security) {
|
|
|
6557
6557
|
} catch {
|
|
6558
6558
|
}
|
|
6559
6559
|
}
|
|
6560
|
-
var _invalidPathNoted = false;
|
|
6561
|
-
function resolveLocalLogDir(rawPath) {
|
|
6562
|
-
const dir = String(rawPath || "").trim().replace(/[\\/]+$/, "");
|
|
6563
|
-
if (!dir)
|
|
6564
|
-
return null;
|
|
6565
|
-
if (isAbsolute(dir))
|
|
6566
|
-
return dir;
|
|
6567
|
-
const fallback = resolve(homedir(), ".solongate", "local-logs");
|
|
6568
|
-
if (!_invalidPathNoted) {
|
|
6569
|
-
_invalidPathNoted = true;
|
|
6570
|
-
try {
|
|
6571
|
-
mkdirSync(resolve(homedir(), ".solongate"), { recursive: true });
|
|
6572
|
-
writeFileSync(
|
|
6573
|
-
resolve(homedir(), ".solongate", ".local-logs-invalid-path"),
|
|
6574
|
-
JSON.stringify({ configured: dir, fallback, ts: Date.now() })
|
|
6575
|
-
);
|
|
6576
|
-
} catch {
|
|
6577
|
-
}
|
|
6578
|
-
}
|
|
6579
|
-
return fallback;
|
|
6580
|
-
}
|
|
6581
6560
|
function writeLocalLog(security, entry) {
|
|
6582
6561
|
try {
|
|
6583
6562
|
const l = security && security.localLogs;
|
|
6584
6563
|
if (!l || !l.enabled || typeof l.path !== "string" || !l.path.trim())
|
|
6585
6564
|
return;
|
|
6586
|
-
|
|
6565
|
+
let dir = String(l.path).trim().replace(/[\\/]+$/, "");
|
|
6587
6566
|
if (!dir)
|
|
6588
6567
|
return;
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
} catch {
|
|
6592
|
-
}
|
|
6593
|
-
const file = join(dir, "solongate-audit.jsonl");
|
|
6568
|
+
if (!isAbsolute(dir))
|
|
6569
|
+
dir = resolve(homedir(), ".solongate", "local-logs");
|
|
6594
6570
|
const line = JSON.stringify(entry) + "\n";
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
appendFileSync(file, line);
|
|
6598
|
-
return;
|
|
6599
|
-
} catch {
|
|
6600
|
-
const _end = Date.now() + 2;
|
|
6601
|
-
while (Date.now() < _end) {
|
|
6602
|
-
}
|
|
6603
|
-
}
|
|
6604
|
-
}
|
|
6605
|
-
try {
|
|
6606
|
-
const payload = Buffer.from(JSON.stringify({ dir, line }), "utf-8").toString("base64");
|
|
6607
|
-
spawn(process.execPath, [process.argv[1], "--sg-log-write", payload], { detached: true, stdio: "ignore" }).unref();
|
|
6608
|
-
} catch {
|
|
6609
|
-
}
|
|
6571
|
+
const payload = Buffer.from(JSON.stringify({ dir, line }), "utf-8").toString("base64");
|
|
6572
|
+
spawn(process.execPath, [process.argv[1], "--sg-log-write", payload], { detached: true, stdio: "ignore" }).unref();
|
|
6610
6573
|
} catch {
|
|
6611
6574
|
}
|
|
6612
6575
|
}
|
package/hooks/guard.mjs
CHANGED
|
@@ -32,7 +32,7 @@ import { createHash } from 'node:crypto';
|
|
|
32
32
|
// the installed hook self-updates when the cloud version is higher (see
|
|
33
33
|
// maybeSelfUpdate). This is what makes guard fixes propagate without a manual
|
|
34
34
|
// reinstall — the same trust model as the OPA WASM this hook already runs.
|
|
35
|
-
const HOOK_VERSION =
|
|
35
|
+
const HOOK_VERSION = 39;
|
|
36
36
|
|
|
37
37
|
// True when local log storage is ON. In that mode logs are kept LOCAL ONLY and
|
|
38
38
|
// nothing is sent to the cloud audit log.
|
|
@@ -100,25 +100,19 @@ function writeLocalLog(security, entry) {
|
|
|
100
100
|
try {
|
|
101
101
|
const l = security && security.localLogs;
|
|
102
102
|
if (!l || !l.enabled || typeof l.path !== 'string' || !l.path.trim()) return;
|
|
103
|
-
|
|
103
|
+
// Resolve the dir with ZERO filesystem work (no mkdir, no marker write) so the
|
|
104
|
+
// detached spawn below is the FIRST syscall. Traced root cause: the earliest
|
|
105
|
+
// guard processes in a burst do extra startup work (policy refresh + WASM),
|
|
106
|
+
// exceed Claude Code's hook timeout, and get SIGKILLed partway THROUGH
|
|
107
|
+
// writeLocalLog — before any append. So we hand the write to a DETACHED child
|
|
108
|
+
// (own process group, survives the kill) IMMEDIATELY, as the very first action,
|
|
109
|
+
// and do it EVERY time (no inline append → no partial-write / duplicate risk).
|
|
110
|
+
let dir = String(l.path).trim().replace(/[\\/]+$/, '');
|
|
104
111
|
if (!dir) return;
|
|
105
|
-
|
|
106
|
-
const file = join(dir, 'solongate-audit.jsonl');
|
|
112
|
+
if (!isAbsolute(dir)) dir = resolve(homedir(), '.solongate', 'local-logs');
|
|
107
113
|
const line = JSON.stringify(entry) + '\n';
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// hook process stays alive (it reaches blockTool), so retry the append a few
|
|
111
|
-
// times with a short spin-backoff until it lands.
|
|
112
|
-
for (let attempt = 0; attempt < 12; attempt++) {
|
|
113
|
-
try { appendFileSync(file, line); return; }
|
|
114
|
-
catch { const _end = Date.now() + 2; while (Date.now() < _end) { /* spin ~2ms */ } }
|
|
115
|
-
}
|
|
116
|
-
// Every inline attempt threw: hand off to a DETACHED child (own process group,
|
|
117
|
-
// survives this process's death) as the final guarantee the entry is written.
|
|
118
|
-
try {
|
|
119
|
-
const payload = Buffer.from(JSON.stringify({ dir, line }), 'utf-8').toString('base64');
|
|
120
|
-
spawn(process.execPath, [process.argv[1], '--sg-log-write', payload], { detached: true, stdio: 'ignore' }).unref();
|
|
121
|
-
} catch {}
|
|
114
|
+
const payload = Buffer.from(JSON.stringify({ dir, line }), 'utf-8').toString('base64');
|
|
115
|
+
spawn(process.execPath, [process.argv[1], '--sg-log-write', payload], { detached: true, stdio: 'ignore' }).unref();
|
|
122
116
|
} catch { /* best-effort */ }
|
|
123
117
|
}
|
|
124
118
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.65",
|
|
4
4
|
"description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|