@solongate/proxy 0.82.36 → 0.82.38

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.
@@ -524,8 +524,8 @@ function flagBool(flags, name) {
524
524
  var USAGE = usage("solongate policy", "manage cloud policies", [
525
525
  ["policy list", "list all policies"],
526
526
  ["policy show <id>", "show one policy (rules, mode)"],
527
- ["policy rules <id>", "list a policy's rules"],
528
527
  ["policy allow <id> --tool <p> [--command|--path|--url <val>]", "append an ALLOW rule"],
528
+ ["policy deny <id> --tool <p> [--command|--path|--url <val>]", "append a DENY rule"],
529
529
  ["policy revoke <id> <ruleId>", "remove a rule"],
530
530
  ["policy active", "show the resolved active policy"],
531
531
  ["policy activate <id> | --clear", "pin / unpin the active policy"],
@@ -548,13 +548,12 @@ async function run(argv) {
548
548
  return 0;
549
549
  }
550
550
  table(
551
- ["ID", "NAME", "MODE", "RULES", "VER", "UPDATED BY"],
551
+ ["ID", "NAME", "MODE", "RULES", "UPDATED BY"],
552
552
  policies.map((p) => [
553
553
  cyan(p.id),
554
554
  truncate(p.name, 28),
555
555
  p.mode === "whitelist" ? green("whitelist") : "denylist",
556
556
  String(p.rules?.length ?? 0),
557
- `v${p.version}`,
558
557
  dim(truncate(p.created_by || "-", 20))
559
558
  ])
560
559
  );
@@ -566,24 +565,18 @@ async function run(argv) {
566
565
  const p = await api.policies.get(id);
567
566
  if (json) return printJson(p), 0;
568
567
  err("");
569
- err(` ${bold(p.name)} ${dim(`(${p.id})`)} v${p._version}`);
568
+ err(` ${bold(p.name)} ${dim(`(${p.id})`)}`);
570
569
  if (p.description) err(` ${dim(p.description)}`);
571
570
  err(` mode: ${p.mode === "whitelist" ? green("whitelist") : "denylist"} rules: ${p.rules.length}`);
572
571
  err("");
573
572
  printRules(p.rules);
574
573
  return 0;
575
574
  }
576
- case "rules": {
575
+ case "allow":
576
+ case "deny": {
577
+ const effect = sub === "allow" ? "ALLOW" : "DENY";
577
578
  const id = positionals[1];
578
- if (!id) return err(" Usage: policy rules <id>"), 1;
579
- const p = await api.policies.get(id);
580
- if (json) return printJson(p.rules), 0;
581
- printRules(p.rules);
582
- return 0;
583
- }
584
- case "allow": {
585
- const id = positionals[1];
586
- if (!id) return err(" Usage: policy allow <id> --tool <pattern> [--command|--path|--url <val>]"), 1;
579
+ if (!id) return err(` Usage: policy ${sub} <id> --tool <pattern> [--command|--path|--url <val>]`), 1;
587
580
  const toolPattern = flagStr(flags, "tool") ?? "*";
588
581
  let kind = "tool";
589
582
  let value;
@@ -594,10 +587,10 @@ async function run(argv) {
594
587
  value = v;
595
588
  }
596
589
  }
597
- const res = await api.policies.addRule(id, { toolPattern, kind, value });
590
+ const res = await api.policies.addRule(id, { toolPattern, kind, value, effect });
598
591
  if (json) return printJson(res), 0;
599
- if (res.deduped) err(green(" \u2713 ") + dim("Equivalent ALLOW rule already present."));
600
- else err(green(` \u2713 Rule added`) + dim(` (${res.rule?.id}) \u2192 v${res.policy_version}`));
592
+ if (res.deduped) err(green(" \u2713 ") + dim(`Equivalent ${effect} rule already present.`));
593
+ else err(green(` \u2713 ${effect} rule added`) + dim(` (${res.rule?.id})`));
601
594
  return 0;
602
595
  }
603
596
  case "revoke": {
@@ -606,7 +599,7 @@ async function run(argv) {
606
599
  if (!id || !ruleId) return err(" Usage: policy revoke <id> <ruleId>"), 1;
607
600
  const res = await api.policies.revokeRule(id, ruleId);
608
601
  if (json) return printJson(res), 0;
609
- err(green(` \u2713 Revoked ${ruleId}`) + dim(` \u2192 v${res.policy_version}`));
602
+ err(green(` \u2713 Revoked ${ruleId}`));
610
603
  return 0;
611
604
  }
612
605
  case "active": {
@@ -617,7 +610,7 @@ async function run(argv) {
617
610
  return 0;
618
611
  }
619
612
  err("");
620
- err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)} v${a.version}`);
613
+ err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)}`);
621
614
  err(` matched by: ${cyan(a.matched_by ?? "-")} self-protection: ${a.self_protection_enabled ? green("on") : dim("off")}`);
622
615
  const rl = a.security?.rateLimit;
623
616
  if (rl) err(` rate limit: ${rl.perMinute}/min ${rl.perHour}/h ${rl.perDay}/day`);
package/dist/index.js CHANGED
@@ -11727,13 +11727,12 @@ async function run(argv) {
11727
11727
  return 0;
11728
11728
  }
11729
11729
  table(
11730
- ["ID", "NAME", "MODE", "RULES", "VER", "UPDATED BY"],
11730
+ ["ID", "NAME", "MODE", "RULES", "UPDATED BY"],
11731
11731
  policies.map((p) => [
11732
11732
  cyan(p.id),
11733
11733
  truncate3(p.name, 28),
11734
11734
  p.mode === "whitelist" ? green("whitelist") : "denylist",
11735
11735
  String(p.rules?.length ?? 0),
11736
- `v${p.version}`,
11737
11736
  dim(truncate3(p.created_by || "-", 20))
11738
11737
  ])
11739
11738
  );
@@ -11745,24 +11744,18 @@ async function run(argv) {
11745
11744
  const p = await api.policies.get(id);
11746
11745
  if (json) return printJson(p), 0;
11747
11746
  err("");
11748
- err(` ${bold(p.name)} ${dim(`(${p.id})`)} v${p._version}`);
11747
+ err(` ${bold(p.name)} ${dim(`(${p.id})`)}`);
11749
11748
  if (p.description) err(` ${dim(p.description)}`);
11750
11749
  err(` mode: ${p.mode === "whitelist" ? green("whitelist") : "denylist"} rules: ${p.rules.length}`);
11751
11750
  err("");
11752
11751
  printRules(p.rules);
11753
11752
  return 0;
11754
11753
  }
11755
- case "rules": {
11754
+ case "allow":
11755
+ case "deny": {
11756
+ const effect = sub === "allow" ? "ALLOW" : "DENY";
11756
11757
  const id = positionals[1];
11757
- if (!id) return err(" Usage: policy rules <id>"), 1;
11758
- const p = await api.policies.get(id);
11759
- if (json) return printJson(p.rules), 0;
11760
- printRules(p.rules);
11761
- return 0;
11762
- }
11763
- case "allow": {
11764
- const id = positionals[1];
11765
- if (!id) return err(" Usage: policy allow <id> --tool <pattern> [--command|--path|--url <val>]"), 1;
11758
+ if (!id) return err(` Usage: policy ${sub} <id> --tool <pattern> [--command|--path|--url <val>]`), 1;
11766
11759
  const toolPattern = flagStr(flags, "tool") ?? "*";
11767
11760
  let kind = "tool";
11768
11761
  let value;
@@ -11773,10 +11766,10 @@ async function run(argv) {
11773
11766
  value = v;
11774
11767
  }
11775
11768
  }
11776
- const res = await api.policies.addRule(id, { toolPattern, kind, value });
11769
+ const res = await api.policies.addRule(id, { toolPattern, kind, value, effect });
11777
11770
  if (json) return printJson(res), 0;
11778
- if (res.deduped) err(green(" \u2713 ") + dim("Equivalent ALLOW rule already present."));
11779
- else err(green(` \u2713 Rule added`) + dim(` (${res.rule?.id}) \u2192 v${res.policy_version}`));
11771
+ if (res.deduped) err(green(" \u2713 ") + dim(`Equivalent ${effect} rule already present.`));
11772
+ else err(green(` \u2713 ${effect} rule added`) + dim(` (${res.rule?.id})`));
11780
11773
  return 0;
11781
11774
  }
11782
11775
  case "revoke": {
@@ -11785,7 +11778,7 @@ async function run(argv) {
11785
11778
  if (!id || !ruleId) return err(" Usage: policy revoke <id> <ruleId>"), 1;
11786
11779
  const res = await api.policies.revokeRule(id, ruleId);
11787
11780
  if (json) return printJson(res), 0;
11788
- err(green(` \u2713 Revoked ${ruleId}`) + dim(` \u2192 v${res.policy_version}`));
11781
+ err(green(` \u2713 Revoked ${ruleId}`));
11789
11782
  return 0;
11790
11783
  }
11791
11784
  case "active": {
@@ -11796,7 +11789,7 @@ async function run(argv) {
11796
11789
  return 0;
11797
11790
  }
11798
11791
  err("");
11799
- err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)} v${a.version}`);
11792
+ err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)}`);
11800
11793
  err(` matched by: ${cyan(a.matched_by ?? "-")} self-protection: ${a.self_protection_enabled ? green("on") : dim("off")}`);
11801
11794
  const rl = a.security?.rateLimit;
11802
11795
  if (rl) err(` rate limit: ${rl.perMinute}/min ${rl.perHour}/h ${rl.perDay}/day`);
@@ -11874,8 +11867,8 @@ var init_policy = __esm({
11874
11867
  USAGE = usage("solongate policy", "manage cloud policies", [
11875
11868
  ["policy list", "list all policies"],
11876
11869
  ["policy show <id>", "show one policy (rules, mode)"],
11877
- ["policy rules <id>", "list a policy's rules"],
11878
11870
  ["policy allow <id> --tool <p> [--command|--path|--url <val>]", "append an ALLOW rule"],
11871
+ ["policy deny <id> --tool <p> [--command|--path|--url <val>]", "append a DENY rule"],
11879
11872
  ["policy revoke <id> <ruleId>", "remove a rule"],
11880
11873
  ["policy active", "show the resolved active policy"],
11881
11874
  ["policy activate <id> | --clear", "pin / unpin the active policy"],
@@ -16252,8 +16245,8 @@ function printHelp() {
16252
16245
  head("Policies");
16253
16246
  cmd("policy list", "list all policies");
16254
16247
  cmd("policy show <id>", "show one policy (rules, mode)");
16255
- cmd("policy rules <id>", "list a policy's rules");
16256
16248
  cmd("policy allow <id> --tool <p> [--command|--path|--url <val>]", "add an ALLOW rule");
16249
+ cmd("policy deny <id> --tool <p> [--command|--path|--url <val>]", "add a DENY rule");
16257
16250
  cmd("policy revoke <id> <ruleId>", "remove a rule");
16258
16251
  cmd("policy activate <id> | --clear", "pin / unpin the active policy");
16259
16252
  cmd("policy active", "show the resolved active policy");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.82.36",
3
+ "version": "0.82.38",
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": {