@solongate/proxy 0.15.4 → 0.15.5
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/hooks/guard.mjs +17 -6
- package/package.json +1 -1
package/hooks/guard.mjs
CHANGED
|
@@ -310,13 +310,24 @@ process.stdin.on('end', async () => {
|
|
|
310
310
|
const candidates = [s, ...segments];
|
|
311
311
|
for (const candidate of candidates) {
|
|
312
312
|
if (!candidate.includes('*') && !candidate.includes('?')) continue;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
313
|
+
// Simple prefix match: ".antig*" → prefix ".antig", check if any protected path starts with it
|
|
314
|
+
const starIdx = candidate.indexOf('*');
|
|
315
|
+
const qIdx = candidate.indexOf('?');
|
|
316
|
+
const firstWild = starIdx === -1 ? qIdx : qIdx === -1 ? starIdx : Math.min(starIdx, qIdx);
|
|
317
|
+
const prefix = candidate.slice(0, firstWild).toLowerCase();
|
|
318
|
+
if (prefix.length > 0) {
|
|
319
|
+
for (const p of protectedPaths) {
|
|
320
|
+
if (p.startsWith(prefix)) return p;
|
|
321
|
+
}
|
|
319
322
|
}
|
|
323
|
+
// Also try regex for complex patterns like ".cl?ude"
|
|
324
|
+
try {
|
|
325
|
+
const escaped = candidate.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\\\*/g, '.*').replace(/\\\?/g, '.');
|
|
326
|
+
const re = new RegExp('^' + escaped + '$', 'i');
|
|
327
|
+
for (const p of protectedPaths) {
|
|
328
|
+
if (re.test(p)) return p;
|
|
329
|
+
}
|
|
330
|
+
} catch { /* invalid regex, skip */ }
|
|
320
331
|
}
|
|
321
332
|
return null;
|
|
322
333
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.5",
|
|
4
4
|
"description": "MCP security proxy — protect any MCP server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|