@solongate/proxy 0.82.40 → 0.82.42
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/commands/index.js +23 -6
- package/dist/index.js +29 -12
- package/dist/tui/index.js +2 -4
- package/package.json +1 -1
package/dist/commands/index.js
CHANGED
|
@@ -523,9 +523,11 @@ function flagBool(flags, name) {
|
|
|
523
523
|
// src/commands/policy.ts
|
|
524
524
|
var USAGE = usage("solongate policy", "manage cloud policies", [
|
|
525
525
|
["policy list", "list all policies"],
|
|
526
|
+
["policy create <name>", "create a new empty policy"],
|
|
527
|
+
["policy delete <id>", "delete a policy"],
|
|
526
528
|
["policy show <id>", "show one policy (rules, mode)"],
|
|
527
|
-
["policy allow <id>
|
|
528
|
-
["policy deny <id>
|
|
529
|
+
["policy allow <id> [--command|--path|--url <val>]", "append an ALLOW rule"],
|
|
530
|
+
["policy deny <id> [--command|--path|--url <val>]", "append a DENY rule"],
|
|
529
531
|
["policy revoke <id> <ruleId>", "remove a rule"],
|
|
530
532
|
["policy active", "show the resolved active policy"],
|
|
531
533
|
["policy activate <id> | --clear", "pin / unpin the active policy"],
|
|
@@ -572,12 +574,28 @@ async function run(argv) {
|
|
|
572
574
|
printRules(p.rules);
|
|
573
575
|
return 0;
|
|
574
576
|
}
|
|
577
|
+
case "create": {
|
|
578
|
+
const name = positionals.slice(1).join(" ").trim();
|
|
579
|
+
if (!name) return err(" Usage: policy create <name>"), 1;
|
|
580
|
+
const res = await api.policies.create({ id: `policy-${Date.now()}`, name, rules: [], mode: "denylist" });
|
|
581
|
+
if (json) return printJson(res), 0;
|
|
582
|
+
err(green(` \u2713 Created "${name}"`) + dim(` (${res.id})`));
|
|
583
|
+
return 0;
|
|
584
|
+
}
|
|
585
|
+
case "delete": {
|
|
586
|
+
const id = positionals[1];
|
|
587
|
+
if (!id) return err(" Usage: policy delete <id>"), 1;
|
|
588
|
+
const res = await api.policies.remove(id);
|
|
589
|
+
if (json) return printJson(res), 0;
|
|
590
|
+
err(green(` \u2713 Deleted ${res.policy_id}`));
|
|
591
|
+
return 0;
|
|
592
|
+
}
|
|
575
593
|
case "allow":
|
|
576
594
|
case "deny": {
|
|
577
595
|
const effect = sub === "allow" ? "ALLOW" : "DENY";
|
|
578
596
|
const id = positionals[1];
|
|
579
|
-
if (!id) return err(` Usage: policy ${sub} <id>
|
|
580
|
-
const toolPattern =
|
|
597
|
+
if (!id) return err(` Usage: policy ${sub} <id> [--command|--path|--url <val>]`), 1;
|
|
598
|
+
const toolPattern = "*";
|
|
581
599
|
let kind = "tool";
|
|
582
600
|
let value;
|
|
583
601
|
for (const k of ["command", "path", "url"]) {
|
|
@@ -660,11 +678,10 @@ async function run(argv) {
|
|
|
660
678
|
function printRules(rules) {
|
|
661
679
|
if (rules.length === 0) return void err(dim(" (no rules)"));
|
|
662
680
|
table(
|
|
663
|
-
["EFFECT", "PRIO", "
|
|
681
|
+
["EFFECT", "PRIO", "ID", "DESCRIPTION"],
|
|
664
682
|
rules.map((r) => [
|
|
665
683
|
r.effect === "ALLOW" ? green("ALLOW") : decisionColor("DENY"),
|
|
666
684
|
String(r.priority),
|
|
667
|
-
cyan(truncate(r.toolPattern, 24)),
|
|
668
685
|
dim(r.id),
|
|
669
686
|
truncate(r.description || "-", 40)
|
|
670
687
|
])
|
package/dist/index.js
CHANGED
|
@@ -8893,8 +8893,7 @@ function PoliciesPanel({ focused }) {
|
|
|
8893
8893
|
{ header: "ON", width: 2 },
|
|
8894
8894
|
{ header: "EFFECT", width: 7 },
|
|
8895
8895
|
{ header: "PRIO", width: 4 },
|
|
8896
|
-
{ header: "
|
|
8897
|
-
{ header: "DESCRIPTION", width: 30 },
|
|
8896
|
+
{ header: "DESCRIPTION", width: 38 },
|
|
8898
8897
|
{ header: "CONSTRAINTS", width: 14 }
|
|
8899
8898
|
],
|
|
8900
8899
|
rows: rWin.map((r, wi) => {
|
|
@@ -8904,8 +8903,7 @@ function PoliciesPanel({ focused }) {
|
|
|
8904
8903
|
{ value: r.enabled ? "\u25CF" : "\u25CB", color: r.enabled ? theme.ok : theme.dim },
|
|
8905
8904
|
{ value: r.effect, color: r.effect === "ALLOW" ? theme.ok : theme.bad, dim: !r.enabled },
|
|
8906
8905
|
{ value: String(r.priority), dim: true },
|
|
8907
|
-
{ value: truncate2(r.
|
|
8908
|
-
{ value: truncate2(r.description || "-", 30), dim: !r.enabled },
|
|
8906
|
+
{ value: truncate2(r.description || "-", 38), dim: !r.enabled },
|
|
8909
8907
|
{ value: ruleSummary(r) || "-", dim: true }
|
|
8910
8908
|
];
|
|
8911
8909
|
})
|
|
@@ -11396,12 +11394,28 @@ async function run(argv) {
|
|
|
11396
11394
|
printRules(p.rules);
|
|
11397
11395
|
return 0;
|
|
11398
11396
|
}
|
|
11397
|
+
case "create": {
|
|
11398
|
+
const name = positionals.slice(1).join(" ").trim();
|
|
11399
|
+
if (!name) return err(" Usage: policy create <name>"), 1;
|
|
11400
|
+
const res = await api.policies.create({ id: `policy-${Date.now()}`, name, rules: [], mode: "denylist" });
|
|
11401
|
+
if (json) return printJson(res), 0;
|
|
11402
|
+
err(green(` \u2713 Created "${name}"`) + dim(` (${res.id})`));
|
|
11403
|
+
return 0;
|
|
11404
|
+
}
|
|
11405
|
+
case "delete": {
|
|
11406
|
+
const id = positionals[1];
|
|
11407
|
+
if (!id) return err(" Usage: policy delete <id>"), 1;
|
|
11408
|
+
const res = await api.policies.remove(id);
|
|
11409
|
+
if (json) return printJson(res), 0;
|
|
11410
|
+
err(green(` \u2713 Deleted ${res.policy_id}`));
|
|
11411
|
+
return 0;
|
|
11412
|
+
}
|
|
11399
11413
|
case "allow":
|
|
11400
11414
|
case "deny": {
|
|
11401
11415
|
const effect = sub === "allow" ? "ALLOW" : "DENY";
|
|
11402
11416
|
const id = positionals[1];
|
|
11403
|
-
if (!id) return err(` Usage: policy ${sub} <id>
|
|
11404
|
-
const toolPattern =
|
|
11417
|
+
if (!id) return err(` Usage: policy ${sub} <id> [--command|--path|--url <val>]`), 1;
|
|
11418
|
+
const toolPattern = "*";
|
|
11405
11419
|
let kind = "tool";
|
|
11406
11420
|
let value;
|
|
11407
11421
|
for (const k of ["command", "path", "url"]) {
|
|
@@ -11484,11 +11498,10 @@ async function run(argv) {
|
|
|
11484
11498
|
function printRules(rules) {
|
|
11485
11499
|
if (rules.length === 0) return void err(dim(" (no rules)"));
|
|
11486
11500
|
table(
|
|
11487
|
-
["EFFECT", "PRIO", "
|
|
11501
|
+
["EFFECT", "PRIO", "ID", "DESCRIPTION"],
|
|
11488
11502
|
rules.map((r) => [
|
|
11489
11503
|
r.effect === "ALLOW" ? green("ALLOW") : decisionColor2("DENY"),
|
|
11490
11504
|
String(r.priority),
|
|
11491
|
-
cyan(truncate3(r.toolPattern, 24)),
|
|
11492
11505
|
dim(r.id),
|
|
11493
11506
|
truncate3(r.description || "-", 40)
|
|
11494
11507
|
])
|
|
@@ -11511,9 +11524,11 @@ var init_policy = __esm({
|
|
|
11511
11524
|
init_format();
|
|
11512
11525
|
USAGE = usage("solongate policy", "manage cloud policies", [
|
|
11513
11526
|
["policy list", "list all policies"],
|
|
11527
|
+
["policy create <name>", "create a new empty policy"],
|
|
11528
|
+
["policy delete <id>", "delete a policy"],
|
|
11514
11529
|
["policy show <id>", "show one policy (rules, mode)"],
|
|
11515
|
-
["policy allow <id>
|
|
11516
|
-
["policy deny <id>
|
|
11530
|
+
["policy allow <id> [--command|--path|--url <val>]", "append an ALLOW rule"],
|
|
11531
|
+
["policy deny <id> [--command|--path|--url <val>]", "append a DENY rule"],
|
|
11517
11532
|
["policy revoke <id> <ruleId>", "remove a rule"],
|
|
11518
11533
|
["policy active", "show the resolved active policy"],
|
|
11519
11534
|
["policy activate <id> | --clear", "pin / unpin the active policy"],
|
|
@@ -15915,9 +15930,11 @@ function printHelp() {
|
|
|
15915
15930
|
cmd("logs-server status", "show the local audit-log service status");
|
|
15916
15931
|
head("Policies");
|
|
15917
15932
|
cmd("policy list", "list all policies");
|
|
15933
|
+
cmd("policy create <name>", "create a new empty policy");
|
|
15934
|
+
cmd("policy delete <id>", "delete a policy");
|
|
15918
15935
|
cmd("policy show <id>", "show one policy (rules, mode)");
|
|
15919
|
-
cmd("policy allow <id>
|
|
15920
|
-
cmd("policy deny <id>
|
|
15936
|
+
cmd("policy allow <id> [--command|--path|--url <val>]", "add an ALLOW rule");
|
|
15937
|
+
cmd("policy deny <id> [--command|--path|--url <val>]", "add a DENY rule");
|
|
15921
15938
|
cmd("policy revoke <id> <ruleId>", "remove a rule");
|
|
15922
15939
|
cmd("policy activate <id> | --clear", "pin / unpin the active policy");
|
|
15923
15940
|
cmd("policy active", "show the resolved active policy");
|
package/dist/tui/index.js
CHANGED
|
@@ -2359,8 +2359,7 @@ function PoliciesPanel({ focused }) {
|
|
|
2359
2359
|
{ header: "ON", width: 2 },
|
|
2360
2360
|
{ header: "EFFECT", width: 7 },
|
|
2361
2361
|
{ header: "PRIO", width: 4 },
|
|
2362
|
-
{ header: "
|
|
2363
|
-
{ header: "DESCRIPTION", width: 30 },
|
|
2362
|
+
{ header: "DESCRIPTION", width: 38 },
|
|
2364
2363
|
{ header: "CONSTRAINTS", width: 14 }
|
|
2365
2364
|
],
|
|
2366
2365
|
rows: rWin.map((r, wi) => {
|
|
@@ -2370,8 +2369,7 @@ function PoliciesPanel({ focused }) {
|
|
|
2370
2369
|
{ value: r.enabled ? "\u25CF" : "\u25CB", color: r.enabled ? theme.ok : theme.dim },
|
|
2371
2370
|
{ value: r.effect, color: r.effect === "ALLOW" ? theme.ok : theme.bad, dim: !r.enabled },
|
|
2372
2371
|
{ value: String(r.priority), dim: true },
|
|
2373
|
-
{ value: truncate(r.
|
|
2374
|
-
{ value: truncate(r.description || "-", 30), dim: !r.enabled },
|
|
2372
|
+
{ value: truncate(r.description || "-", 38), dim: !r.enabled },
|
|
2375
2373
|
{ value: ruleSummary(r) || "-", dim: true }
|
|
2376
2374
|
];
|
|
2377
2375
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.42",
|
|
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": {
|