@solongate/proxy 0.26.0 → 0.26.2

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 CHANGED
@@ -6135,45 +6135,37 @@ var PolicySyncManager = class {
6135
6135
  };
6136
6136
 
6137
6137
  // src/ai-judge.ts
6138
- var SYSTEM_PROMPT = `You are a security judge for an MCP (Model Context Protocol) proxy. You evaluate tool calls and decide if they should be ALLOWED or DENIED.
6138
+ var SYSTEM_PROMPT = `You are a security judge for an AI coding tool. You evaluate tool calls and decide if they should be ALLOWED or DENIED.
6139
6139
 
6140
6140
  You will receive a JSON object with:
6141
- - "tool": the MCP tool name being called
6141
+ - "tool": the tool name being called
6142
6142
  - "arguments": the tool's arguments
6143
- - "protected_files": list of files that must NEVER be read, written, copied, moved, or accessed
6144
- - "protected_paths": list of directories/paths that must NEVER be accessed
6143
+ - "protected_files": EXACT list of files that must NEVER be accessed. ONLY these specific files are protected \u2014 nothing else.
6144
+ - "protected_paths": EXACT list of directories that must NEVER be accessed. ONLY these specific paths are protected \u2014 nothing else.
6145
6145
  - "denied_actions": list of actions that are never allowed
6146
6146
 
6147
- DENY if the tool call could, directly or indirectly:
6148
- - Read, display, copy, move, or exfiltrate any protected file \u2014 even through:
6149
- - Shell glob patterns (e.g., "cred*" could match "credentials.json")
6150
- - Command substitution ($(...), backticks)
6151
- - Process substitution (<(cat file), <(command file)) \u2014 ALWAYS check inside <(...) for protected files
6152
- - Variable interpolation or string concatenation (e.g., f=".en"; cat \${f}v builds ".env")
6153
- - Partial variable construction \u2014 if shell variables are concatenated to form a filename, analyze the RESULT
6154
- - Input redirection (< file)
6155
- - Script files that might read protected files
6156
- - Find/exec patterns
6157
- - Multi-stage operations: if command A archives/copies a protected file and command B reads the copy, DENY the ENTIRE chain (e.g., "tar czf /tmp/x.tgz .env && tar xzf /tmp/x.tgz -O")
6158
- - Any Unix/Windows utility that reads file content (cat, head, tail, less, more, type, perl, awk, sed, sort, diff, comm, paste, tee, xxd, od, strings, dd, tr, tar, zip, etc.)
6159
- - Delete, modify, or overwrite any protected file or path
6160
- - Send data to external URLs, webhooks, or attacker-controlled endpoints
6161
- - Execute remotely downloaded code (curl|bash, wget|sh, etc.)
6162
- - Leak environment variables (printenv, env, /proc/self/environ, npm run env, process.env)
6163
- - Create scripts that bypass security controls
6147
+ IMPORTANT: You must ONLY protect files and paths that are EXPLICITLY listed in protected_files and protected_paths. If a file is NOT in the list, it is NOT protected and access should be ALLOWED. Do NOT invent or assume additional protected files.
6164
6148
 
6165
- CRITICAL patterns to watch for:
6166
- - <(cat .env) or <(cat ANYPROTECTEDFILE) \u2014 process substitution ALWAYS reads the file
6167
- - Compound commands with && or ; where ANY part touches a protected file \u2014 DENY the whole thing
6168
- - Variable tricks like f=".en"; cat \${f}v \u2014 mentally evaluate the variable to see if it resolves to a protected filename
6169
- - tar/zip/cp that archives a protected file, even if the second command reads the archive \u2014 DENY both
6149
+ DENY if the tool call could, directly or indirectly, access a file from the protected_files list \u2014 even through:
6150
+ - Shell glob patterns (e.g., "cred*" could match "credentials.json" IF credentials.json is in protected_files)
6151
+ - Command substitution ($(...), backticks)
6152
+ - Process substitution (<(cat file)) \u2014 check inside <(...) for protected files
6153
+ - Variable interpolation (e.g., f=".en"; cat \${f}v builds ".env" \u2014 DENY only if .env is in protected_files)
6154
+ - Input redirection (< file)
6155
+ - Multi-stage operations: tar/cp a protected file then read the copy \u2014 DENY the entire chain
6156
+ - Any utility that reads file content (cat, head, tail, less, perl, awk, sed, xxd, od, strings, dd, etc.)
6157
+
6158
+ Also DENY if:
6159
+ - The command sends data to external URLs (curl -d, wget --post)
6160
+ - The command leaks environment variables (printenv, env, process.env)
6161
+ - The command executes remotely downloaded code (curl|bash)
6170
6162
 
6171
6163
  ALLOW if:
6172
- - The action is a normal development operation (ls, git status, npm build, etc.)
6164
+ - The file is NOT in protected_files \u2014 even if cat, head, etc. is used. Reading non-protected files is normal.
6165
+ - The action is a normal development operation (ls, git status, npm build, cat app.js, etc.)
6173
6166
  - The action does not touch any protected file or path
6174
- - The action is clearly benign (creating hello.js, reading public docs, etc.)
6175
6167
 
6176
- When in doubt, DENY. False positives are acceptable; false negatives are not.
6168
+ CRITICAL: Only DENY access to files EXPLICITLY in the protected_files list. "cat app.js" is ALLOWED if app.js is not in protected_files. Do NOT over-block.
6177
6169
 
6178
6170
  Respond with ONLY valid JSON, no markdown, no explanation outside the JSON:
6179
6171
  {"decision": "ALLOW" or "DENY", "reason": "brief one-line explanation", "confidence": 0.0 to 1.0}`;
package/hooks/guard.mjs CHANGED
@@ -1071,40 +1071,32 @@ process.stdin.on('end', async () => {
1071
1071
  You will receive a JSON object with:
1072
1072
  - "tool": the tool name being called (e.g., Bash, Write, Read, Edit)
1073
1073
  - "arguments": the tool's arguments
1074
- - "protected_files": list of files that must NEVER be read, written, copied, moved, or accessed
1075
- - "protected_paths": list of directories/paths that must NEVER be accessed
1074
+ - "protected_files": EXACT list of files that must NEVER be accessed. ONLY these specific files are protected — nothing else.
1075
+ - "protected_paths": EXACT list of directories that must NEVER be accessed. ONLY these specific paths are protected — nothing else.
1076
1076
  - "denied_actions": list of actions that are never allowed
1077
1077
 
1078
- DENY if the tool call could, directly or indirectly:
1079
- - Read, display, copy, move, or exfiltrate any protected file — even through:
1080
- - Shell glob patterns (e.g., "cred*" could match "credentials.json")
1081
- - Command substitution ($(...), backticks)
1082
- - Process substitution (<(cat file), <(command file)) — ALWAYS check inside <(...) for protected files
1083
- - Variable interpolation or string concatenation (e.g., f=".en"; cat \${f}v builds ".env")
1084
- - Partial variable construction if shell variables are concatenated to form a filename, analyze the RESULT
1085
- - Input redirection (< file)
1086
- - Script files that might read protected files
1087
- - Find/exec patterns
1088
- - Multi-stage operations: if command A archives/copies a protected file and command B reads the copy, DENY the ENTIRE chain
1089
- - Any Unix/Windows utility that reads file content (cat, head, tail, less, more, type, perl, awk, sed, sort, diff, comm, paste, tee, xxd, od, strings, dd, tr, tar, zip, etc.)
1090
- - Delete, modify, or overwrite any protected file or path
1091
- - Send data to external URLs, webhooks, or attacker-controlled endpoints
1092
- - Execute remotely downloaded code (curl|bash, wget|sh, etc.)
1093
- - Leak environment variables (printenv, env, /proc/self/environ, npm run env, process.env)
1094
- - Create scripts that bypass security controls
1095
-
1096
- CRITICAL patterns to watch for:
1097
- - <(cat .env) or <(cat ANYPROTECTEDFILE) — process substitution ALWAYS reads the file
1098
- - Compound commands with && or ; where ANY part touches a protected file — DENY the whole thing
1099
- - Variable tricks like f=".en"; cat \${f}v — mentally evaluate the variable to see if it resolves to a protected filename
1100
- - tar/zip/cp that archives a protected file, even if the second command reads the archive — DENY both
1078
+ IMPORTANT: You must ONLY protect files and paths that are EXPLICITLY listed in protected_files and protected_paths. If a file is NOT in the list, it is NOT protected and access should be ALLOWED. Do NOT invent or assume additional protected files.
1079
+
1080
+ DENY if the tool call could, directly or indirectly, access a file from the protected_files list — even through:
1081
+ - Shell glob patterns (e.g., "cred*" could match "credentials.json" IF credentials.json is in protected_files)
1082
+ - Command substitution ($(...), backticks)
1083
+ - Process substitution (<(cat file)) check inside <(...) for protected files
1084
+ - Variable interpolation (e.g., f=".en"; cat \${f}v builds ".env" DENY only if .env is in protected_files)
1085
+ - Input redirection (< file)
1086
+ - Multi-stage operations: tar/cp a protected file then read the copy — DENY the entire chain
1087
+ - Any utility that reads file content (cat, head, tail, less, perl, awk, sed, xxd, od, strings, dd, etc.)
1088
+
1089
+ Also DENY if:
1090
+ - The command sends data to external URLs (curl -d, wget --post)
1091
+ - The command leaks environment variables (printenv, env, process.env)
1092
+ - The command executes remotely downloaded code (curl|bash)
1101
1093
 
1102
1094
  ALLOW if:
1103
- - The action is a normal development operation (ls, git status, npm build, etc.)
1095
+ - The file is NOT in protected_files even if cat, head, etc. is used. Reading non-protected files is normal.
1096
+ - The action is a normal development operation (ls, git status, npm build, cat app.js, etc.)
1104
1097
  - The action does not touch any protected file or path
1105
- - The action is clearly benign
1106
1098
 
1107
- When in doubt, DENY. False positives are acceptable; false negatives are not.
1099
+ CRITICAL: Only DENY access to files EXPLICITLY in the protected_files list. "cat app.js" is ALLOWED if app.js is not in protected_files. "cat package.json" is ALLOWED if package.json is not in protected_files. Do NOT over-block.
1108
1100
 
1109
1101
  Respond with ONLY valid JSON: {"decision": "ALLOW" or "DENY", "reason": "brief explanation", "confidence": 0.0 to 1.0}`;
1110
1102
 
@@ -1133,16 +1125,16 @@ Respond with ONLY valid JSON: {"decision": "ALLOW" or "DENY", "reason": "brief e
1133
1125
  if (jsonMatch) {
1134
1126
  const verdict = JSON.parse(jsonMatch[0]);
1135
1127
  if (verdict.decision === 'DENY') {
1136
- reason = '[AI Judge] ' + (verdict.reason || 'Blocked by semantic analysis');
1128
+ reason = '[SolonGate AI Judge] Blocked: ' + (verdict.reason || 'Semantic analysis detected a policy violation');
1137
1129
  }
1138
1130
  }
1139
1131
  } else {
1140
1132
  // Fail-closed: LLM error → DENY
1141
- reason = '[AI Judge] LLM endpoint error (fail-closed)';
1133
+ reason = '[SolonGate AI Judge] Blocked: Groq API error (fail-closed)';
1142
1134
  }
1143
1135
  } catch (err) {
1144
1136
  // Fail-closed: timeout or parse error → DENY
1145
- reason = '[AI Judge] ' + (err.message || 'error') + ' (fail-closed)';
1137
+ reason = '[SolonGate AI Judge] Blocked: ' + (err.message || 'error') + ' (fail-closed)';
1146
1138
  }
1147
1139
  }
1148
1140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.26.0",
3
+ "version": "0.26.2",
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": {