@solongate/proxy 0.81.63 → 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.
@@ -58,3 +58,5 @@
58
58
  {"ms":4,"ts":1784374792946,"tool":"Write","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
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
+ {"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":3,"ts":1784374848281,"tool":"Bash","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
1
+ {"ms":5,"ts":1784375813890,"tool":"Bash","session":"f5933c65-c315-4440-9afb-7136fce6b695"}
@@ -1 +1 @@
1
- 1784374838541
1
+ 1784375802574
@@ -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 = 37;
6539
+ var HOOK_VERSION = 39;
6540
6540
  function localLogsOnly(security) {
6541
6541
  if (security && typeof security === "object") {
6542
6542
  const l = security.localLogs;
@@ -6557,35 +6557,16 @@ 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
- const dir = resolveLocalLogDir(l.path);
6565
+ let dir = String(l.path).trim().replace(/[\\/]+$/, "");
6587
6566
  if (!dir)
6588
6567
  return;
6568
+ if (!isAbsolute(dir))
6569
+ dir = resolve(homedir(), ".solongate", "local-logs");
6589
6570
  const line = JSON.stringify(entry) + "\n";
6590
6571
  const payload = Buffer.from(JSON.stringify({ dir, line }), "utf-8").toString("base64");
6591
6572
  spawn(process.execPath, [process.argv[1], "--sg-log-write", payload], { detached: true, stdio: "ignore" }).unref();
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 = 37;
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,13 +100,17 @@ 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
- const dir = resolveLocalLogDir(l.path);
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;
112
+ if (!isAbsolute(dir)) dir = resolve(homedir(), '.solongate', 'local-logs');
105
113
  const line = JSON.stringify(entry) + '\n';
106
- // GUARANTEED write: hand the append to a DETACHED child in its own process
107
- // group. Even if Claude Code kills this hook mid-write during a concurrent
108
- // denial burst, the child survives and completes the append — no denial is
109
- // ever lost from the local log. (Inline appends dropped under burst.)
110
114
  const payload = Buffer.from(JSON.stringify({ dir, line }), 'utf-8').toString('base64');
111
115
  spawn(process.execPath, [process.argv[1], '--sg-log-write', payload], { detached: true, stdio: 'ignore' }).unref();
112
116
  } catch { /* best-effort */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.63",
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": {