@solongate/proxy 0.81.11 → 0.81.12
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/index.js +2 -2
- package/dist/shield.js +2 -2
- package/hooks/audit.mjs +1 -1
- package/hooks/guard.bundled.mjs +1 -1
- package/hooks/guard.mjs +1 -1
- package/hooks/shield.mjs +6 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10927,7 +10927,7 @@ function redactString(s, cfg) {
|
|
|
10927
10927
|
for (const p of DLP_PATTERNS) if (allow.has(p.name)) out2 = out2.replace(p.re, `[REDACTED: ${p.name}]`);
|
|
10928
10928
|
for (const c2 of cfg.custom) {
|
|
10929
10929
|
try {
|
|
10930
|
-
out2 = out2.replace(dlpGlobToRe(c2.re, "
|
|
10930
|
+
out2 = out2.replace(dlpGlobToRe(c2.re, "gi"), `[REDACTED: ${c2.name || "custom"}]`);
|
|
10931
10931
|
} catch {
|
|
10932
10932
|
}
|
|
10933
10933
|
}
|
|
@@ -10960,9 +10960,9 @@ function pickUpstream() {
|
|
|
10960
10960
|
}
|
|
10961
10961
|
}
|
|
10962
10962
|
function startProxy(upstream) {
|
|
10963
|
-
const cfg = loadCfg();
|
|
10964
10963
|
const forward = upstream.protocol === "https:" ? httpsRequest : httpRequest;
|
|
10965
10964
|
const server = createServer((req, res) => {
|
|
10965
|
+
const cfg = loadCfg();
|
|
10966
10966
|
const chunks = [];
|
|
10967
10967
|
req.on("data", (c2) => chunks.push(c2));
|
|
10968
10968
|
req.on("end", () => {
|
package/dist/shield.js
CHANGED
|
@@ -168,7 +168,7 @@ function redactString(s, cfg) {
|
|
|
168
168
|
for (const p of DLP_PATTERNS) if (allow.has(p.name)) out = out.replace(p.re, `[REDACTED: ${p.name}]`);
|
|
169
169
|
for (const c of cfg.custom) {
|
|
170
170
|
try {
|
|
171
|
-
out = out.replace(dlpGlobToRe(c.re, "
|
|
171
|
+
out = out.replace(dlpGlobToRe(c.re, "gi"), `[REDACTED: ${c.name || "custom"}]`);
|
|
172
172
|
} catch {
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -201,9 +201,9 @@ function pickUpstream() {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
function startProxy(upstream) {
|
|
204
|
-
const cfg = loadCfg();
|
|
205
204
|
const forward = upstream.protocol === "https:" ? httpsRequest : httpRequest;
|
|
206
205
|
const server = createServer((req, res) => {
|
|
206
|
+
const cfg = loadCfg();
|
|
207
207
|
const chunks = [];
|
|
208
208
|
req.on("data", (c) => chunks.push(c));
|
|
209
209
|
req.on("end", () => {
|
package/hooks/audit.mjs
CHANGED
|
@@ -337,7 +337,7 @@ function dlpRedactText(text, cfg) {
|
|
|
337
337
|
if (allow.has(p.name)) out = out.replace(p.re, '[REDACTED:' + p.name + ']');
|
|
338
338
|
}
|
|
339
339
|
for (const c of Array.isArray(cfg.custom) ? cfg.custom : []) {
|
|
340
|
-
try { out = out.replace(dlpGlobToRe(c.re, '
|
|
340
|
+
try { out = out.replace(dlpGlobToRe(c.re, 'gi'), '[REDACTED:' + (c.name || 'custom') + ']'); } catch { /* skip invalid */ }
|
|
341
341
|
}
|
|
342
342
|
return out;
|
|
343
343
|
}
|
package/hooks/guard.bundled.mjs
CHANGED
package/hooks/guard.mjs
CHANGED
|
@@ -834,7 +834,7 @@ function dlpGlobToRe(glob) {
|
|
|
834
834
|
else if ('.+?^${}()|[]\\'.indexOf(ch) !== -1) re += '\\' + ch;
|
|
835
835
|
else re += ch;
|
|
836
836
|
}
|
|
837
|
-
return new RegExp(re);
|
|
837
|
+
return new RegExp(re, 'i');
|
|
838
838
|
}
|
|
839
839
|
// Scan args against the enabled built-in patterns + any user custom patterns.
|
|
840
840
|
// `cfg` = { patterns: string[], custom: {name,re}[] }.
|
package/hooks/shield.mjs
CHANGED
|
@@ -176,7 +176,7 @@ function redactString(s, cfg) {
|
|
|
176
176
|
let out = s;
|
|
177
177
|
for (const p of DLP_PATTERNS) if (allow.has(p.name)) out = out.replace(p.re, `[REDACTED: ${p.name}]`);
|
|
178
178
|
for (const c of cfg.custom) {
|
|
179
|
-
try { out = out.replace(dlpGlobToRe(c.re, '
|
|
179
|
+
try { out = out.replace(dlpGlobToRe(c.re, 'gi'), `[REDACTED: ${c.name || 'custom'}]`); } catch { /* skip */ }
|
|
180
180
|
}
|
|
181
181
|
return out;
|
|
182
182
|
}
|
|
@@ -210,9 +210,13 @@ function pickUpstream() {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
function startProxy(upstream) {
|
|
213
|
-
const cfg = loadCfg();
|
|
214
213
|
const forward = upstream.protocol === 'https:' ? httpsRequest : httpRequest;
|
|
215
214
|
const server = createServer((req, res) => {
|
|
215
|
+
// Re-read the DLP config on every request (cheap: a small JSON) so changing
|
|
216
|
+
// DLP mode / patterns in the dashboard takes effect WITHOUT restarting claude —
|
|
217
|
+
// the guard rewrites this cache within ~one call, matching how the audit hook
|
|
218
|
+
// already re-reads per call. Loading once at startup left the shield stale.
|
|
219
|
+
const cfg = loadCfg();
|
|
216
220
|
const chunks = [];
|
|
217
221
|
req.on('data', (c) => chunks.push(c));
|
|
218
222
|
req.on('end', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.12",
|
|
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": {
|