@solongate/proxy 0.34.0 → 0.36.0
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 +22 -0
- package/dist/lib.js +19 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -274,6 +274,9 @@ function parseArgs(argv) {
|
|
|
274
274
|
aiJudgeApiKey = process.env.GROQ_API_KEY;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
+
if (aiJudgeApiKey && (aiJudgeApiKey.includes("your_") || aiJudgeApiKey.includes("_here") || aiJudgeApiKey.length < 10)) {
|
|
278
|
+
aiJudgeApiKey = void 0;
|
|
279
|
+
}
|
|
277
280
|
const aiJudge = aiJudgeEnabled ? {
|
|
278
281
|
enabled: true,
|
|
279
282
|
model: aiJudgeModel,
|
|
@@ -5671,6 +5674,12 @@ CRITICAL: Only DENY access to files EXPLICITLY in the protected_files list. "cat
|
|
|
5671
5674
|
|
|
5672
5675
|
Respond with ONLY valid JSON, no markdown, no explanation outside the JSON:
|
|
5673
5676
|
{"decision": "ALLOW" or "DENY", "reason": "brief one-line explanation", "confidence": 0.0 to 1.0}`;
|
|
5677
|
+
var AuthError = class extends Error {
|
|
5678
|
+
constructor(message) {
|
|
5679
|
+
super(message);
|
|
5680
|
+
this.name = "AuthError";
|
|
5681
|
+
}
|
|
5682
|
+
};
|
|
5674
5683
|
var AiJudge = class _AiJudge {
|
|
5675
5684
|
config;
|
|
5676
5685
|
protectedFiles;
|
|
@@ -5727,6 +5736,13 @@ var AiJudge = class _AiJudge {
|
|
|
5727
5736
|
this.consecutiveFailures++;
|
|
5728
5737
|
this.lastFailureTime = Date.now();
|
|
5729
5738
|
const message = err instanceof Error ? err.message : String(err);
|
|
5739
|
+
if (err instanceof AuthError) {
|
|
5740
|
+
return {
|
|
5741
|
+
decision: "ALLOW",
|
|
5742
|
+
reason: `AI Judge auth error (skipping): ${message.slice(0, 100)}`,
|
|
5743
|
+
confidence: 0.5
|
|
5744
|
+
};
|
|
5745
|
+
}
|
|
5730
5746
|
return {
|
|
5731
5747
|
decision: "DENY",
|
|
5732
5748
|
reason: `AI Judge error (fail-closed): ${message.slice(0, 100)}`,
|
|
@@ -5808,6 +5824,9 @@ var AiJudge = class _AiJudge {
|
|
|
5808
5824
|
});
|
|
5809
5825
|
if (!res.ok) {
|
|
5810
5826
|
const errBody = await res.text().catch(() => "");
|
|
5827
|
+
if (res.status === 401 || res.status === 403) {
|
|
5828
|
+
throw new AuthError(`LLM auth failed (${res.status}): ${errBody.slice(0, 200)}`);
|
|
5829
|
+
}
|
|
5811
5830
|
throw new Error(`LLM endpoint returned ${res.status}: ${errBody.slice(0, 200)}`);
|
|
5812
5831
|
}
|
|
5813
5832
|
const data = await res.json();
|
|
@@ -6048,6 +6067,9 @@ var SolonGateProxy = class {
|
|
|
6048
6067
|
if (match) groqKey = match[1].trim();
|
|
6049
6068
|
}
|
|
6050
6069
|
if (!groqKey) groqKey = process.env.GROQ_API_KEY;
|
|
6070
|
+
if (groqKey && (groqKey.includes("your_") || groqKey.includes("_here") || groqKey.length < 10)) {
|
|
6071
|
+
groqKey = void 0;
|
|
6072
|
+
}
|
|
6051
6073
|
if (groqKey) {
|
|
6052
6074
|
this.config.aiJudge = {
|
|
6053
6075
|
enabled: true,
|
package/dist/lib.js
CHANGED
|
@@ -3973,6 +3973,12 @@ CRITICAL: Only DENY access to files EXPLICITLY in the protected_files list. "cat
|
|
|
3973
3973
|
|
|
3974
3974
|
Respond with ONLY valid JSON, no markdown, no explanation outside the JSON:
|
|
3975
3975
|
{"decision": "ALLOW" or "DENY", "reason": "brief one-line explanation", "confidence": 0.0 to 1.0}`;
|
|
3976
|
+
var AuthError = class extends Error {
|
|
3977
|
+
constructor(message) {
|
|
3978
|
+
super(message);
|
|
3979
|
+
this.name = "AuthError";
|
|
3980
|
+
}
|
|
3981
|
+
};
|
|
3976
3982
|
var AiJudge = class _AiJudge {
|
|
3977
3983
|
config;
|
|
3978
3984
|
protectedFiles;
|
|
@@ -4029,6 +4035,13 @@ var AiJudge = class _AiJudge {
|
|
|
4029
4035
|
this.consecutiveFailures++;
|
|
4030
4036
|
this.lastFailureTime = Date.now();
|
|
4031
4037
|
const message = err instanceof Error ? err.message : String(err);
|
|
4038
|
+
if (err instanceof AuthError) {
|
|
4039
|
+
return {
|
|
4040
|
+
decision: "ALLOW",
|
|
4041
|
+
reason: `AI Judge auth error (skipping): ${message.slice(0, 100)}`,
|
|
4042
|
+
confidence: 0.5
|
|
4043
|
+
};
|
|
4044
|
+
}
|
|
4032
4045
|
return {
|
|
4033
4046
|
decision: "DENY",
|
|
4034
4047
|
reason: `AI Judge error (fail-closed): ${message.slice(0, 100)}`,
|
|
@@ -4110,6 +4123,9 @@ var AiJudge = class _AiJudge {
|
|
|
4110
4123
|
});
|
|
4111
4124
|
if (!res.ok) {
|
|
4112
4125
|
const errBody = await res.text().catch(() => "");
|
|
4126
|
+
if (res.status === 401 || res.status === 403) {
|
|
4127
|
+
throw new AuthError(`LLM auth failed (${res.status}): ${errBody.slice(0, 200)}`);
|
|
4128
|
+
}
|
|
4113
4129
|
throw new Error(`LLM endpoint returned ${res.status}: ${errBody.slice(0, 200)}`);
|
|
4114
4130
|
}
|
|
4115
4131
|
const data = await res.json();
|
|
@@ -4350,6 +4366,9 @@ var SolonGateProxy = class {
|
|
|
4350
4366
|
if (match) groqKey = match[1].trim();
|
|
4351
4367
|
}
|
|
4352
4368
|
if (!groqKey) groqKey = process.env.GROQ_API_KEY;
|
|
4369
|
+
if (groqKey && (groqKey.includes("your_") || groqKey.includes("_here") || groqKey.length < 10)) {
|
|
4370
|
+
groqKey = void 0;
|
|
4371
|
+
}
|
|
4353
4372
|
if (groqKey) {
|
|
4354
4373
|
this.config.aiJudge = {
|
|
4355
4374
|
enabled: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "AI tool security proxy — protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|