@solongate/proxy 0.1.26 → 0.1.27
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 +26 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1198,8 +1198,9 @@ async function fetchCloudPolicy(apiKey, apiUrl, policyId) {
|
|
|
1198
1198
|
};
|
|
1199
1199
|
}
|
|
1200
1200
|
async function sendAuditLog(apiKey, apiUrl, entry) {
|
|
1201
|
+
const url = `${apiUrl}/api/v1/audit-logs`;
|
|
1201
1202
|
try {
|
|
1202
|
-
await fetch(
|
|
1203
|
+
const res = await fetch(url, {
|
|
1203
1204
|
method: "POST",
|
|
1204
1205
|
headers: {
|
|
1205
1206
|
"Authorization": `Bearer ${apiKey}`,
|
|
@@ -1207,7 +1208,14 @@ async function sendAuditLog(apiKey, apiUrl, entry) {
|
|
|
1207
1208
|
},
|
|
1208
1209
|
body: JSON.stringify(entry)
|
|
1209
1210
|
});
|
|
1210
|
-
|
|
1211
|
+
if (!res.ok) {
|
|
1212
|
+
const body = await res.text().catch(() => "");
|
|
1213
|
+
process.stderr.write(`[SolonGate] Audit log failed (${res.status}): ${body}
|
|
1214
|
+
`);
|
|
1215
|
+
}
|
|
1216
|
+
} catch (err) {
|
|
1217
|
+
process.stderr.write(`[SolonGate] Audit log error: ${err instanceof Error ? err.message : String(err)}
|
|
1218
|
+
`);
|
|
1211
1219
|
}
|
|
1212
1220
|
}
|
|
1213
1221
|
var PRESETS = {
|
|
@@ -3305,6 +3313,7 @@ var SolonGateProxy = class {
|
|
|
3305
3313
|
this.config = config;
|
|
3306
3314
|
this.gate = new SolonGate({
|
|
3307
3315
|
name: config.name ?? "solongate-proxy",
|
|
3316
|
+
apiKey: "sg_test_proxy_internal_00000000",
|
|
3308
3317
|
policySet: config.policy,
|
|
3309
3318
|
config: {
|
|
3310
3319
|
validateSchemas: config.validateInput ?? true,
|
|
@@ -3483,6 +3492,7 @@ var SolonGateProxy = class {
|
|
|
3483
3492
|
log(`Result: ${decision} (${evaluationTimeMs}ms)`);
|
|
3484
3493
|
if (this.config.apiKey && !this.config.apiKey.startsWith("sg_test_")) {
|
|
3485
3494
|
const apiUrl = this.config.apiUrl ?? "https://api.solongate.com";
|
|
3495
|
+
log(`Sending audit log: ${name} \u2192 ${decision} (key: ${this.config.apiKey.slice(0, 16)}...)`);
|
|
3486
3496
|
sendAuditLog(this.config.apiKey, apiUrl, {
|
|
3487
3497
|
tool: name,
|
|
3488
3498
|
arguments: args ?? {},
|
|
@@ -3490,6 +3500,8 @@ var SolonGateProxy = class {
|
|
|
3490
3500
|
reason: result.isError ? result.content[0]?.text ?? "denied" : "allowed",
|
|
3491
3501
|
evaluationTimeMs
|
|
3492
3502
|
});
|
|
3503
|
+
} else {
|
|
3504
|
+
log(`Skipping audit log (apiKey: ${this.config.apiKey ? "test key" : "not set"})`);
|
|
3493
3505
|
}
|
|
3494
3506
|
return {
|
|
3495
3507
|
content: [...result.content],
|
|
@@ -3542,6 +3554,8 @@ var SolonGateProxy = class {
|
|
|
3542
3554
|
registerToolsToCloud() {
|
|
3543
3555
|
if (!this.config.apiKey || this.config.apiKey.startsWith("sg_test_")) return;
|
|
3544
3556
|
const apiUrl = this.config.apiUrl ?? "https://api.solongate.com";
|
|
3557
|
+
let registered = 0;
|
|
3558
|
+
const total = this.upstreamTools.length;
|
|
3545
3559
|
for (const tool of this.upstreamTools) {
|
|
3546
3560
|
fetch(`${apiUrl}/api/v1/tools`, {
|
|
3547
3561
|
method: "POST",
|
|
@@ -3556,10 +3570,18 @@ var SolonGateProxy = class {
|
|
|
3556
3570
|
permissions: this.guessPermissions(tool.name),
|
|
3557
3571
|
enabled: true
|
|
3558
3572
|
})
|
|
3559
|
-
}).
|
|
3573
|
+
}).then(async (res) => {
|
|
3574
|
+
if (res.ok || res.status === 409) {
|
|
3575
|
+
registered++;
|
|
3576
|
+
} else {
|
|
3577
|
+
const body = await res.text().catch(() => "");
|
|
3578
|
+
log(`Tool registration failed for "${tool.name}" (${res.status}): ${body}`);
|
|
3579
|
+
}
|
|
3580
|
+
}).catch((err) => {
|
|
3581
|
+
log(`Tool registration error for "${tool.name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
3560
3582
|
});
|
|
3561
3583
|
}
|
|
3562
|
-
log(`
|
|
3584
|
+
log(`Registering ${total} tools to dashboard...`);
|
|
3563
3585
|
}
|
|
3564
3586
|
/**
|
|
3565
3587
|
* Guess tool permissions from tool name.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "MCP security proxy \u00e2\u20ac\u201d protect any MCP server with policies, input validation, rate limiting, and audit logging. Zero code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|