@solongate/proxy 0.82.37 → 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.
@@ -525,6 +525,7 @@ 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
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"],
528
529
  ["policy revoke <id> <ruleId>", "remove a rule"],
529
530
  ["policy active", "show the resolved active policy"],
530
531
  ["policy activate <id> | --clear", "pin / unpin the active policy"],
@@ -547,13 +548,12 @@ async function run(argv) {
547
548
  return 0;
548
549
  }
549
550
  table(
550
- ["ID", "NAME", "MODE", "RULES", "VER", "UPDATED BY"],
551
+ ["ID", "NAME", "MODE", "RULES", "UPDATED BY"],
551
552
  policies.map((p) => [
552
553
  cyan(p.id),
553
554
  truncate(p.name, 28),
554
555
  p.mode === "whitelist" ? green("whitelist") : "denylist",
555
556
  String(p.rules?.length ?? 0),
556
- `v${p.version}`,
557
557
  dim(truncate(p.created_by || "-", 20))
558
558
  ])
559
559
  );
@@ -565,16 +565,18 @@ async function run(argv) {
565
565
  const p = await api.policies.get(id);
566
566
  if (json) return printJson(p), 0;
567
567
  err("");
568
- err(` ${bold(p.name)} ${dim(`(${p.id})`)} v${p._version}`);
568
+ err(` ${bold(p.name)} ${dim(`(${p.id})`)}`);
569
569
  if (p.description) err(` ${dim(p.description)}`);
570
570
  err(` mode: ${p.mode === "whitelist" ? green("whitelist") : "denylist"} rules: ${p.rules.length}`);
571
571
  err("");
572
572
  printRules(p.rules);
573
573
  return 0;
574
574
  }
575
- case "allow": {
575
+ case "allow":
576
+ case "deny": {
577
+ const effect = sub === "allow" ? "ALLOW" : "DENY";
576
578
  const id = positionals[1];
577
- 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;
578
580
  const toolPattern = flagStr(flags, "tool") ?? "*";
579
581
  let kind = "tool";
580
582
  let value;
@@ -585,10 +587,10 @@ async function run(argv) {
585
587
  value = v;
586
588
  }
587
589
  }
588
- const res = await api.policies.addRule(id, { toolPattern, kind, value });
590
+ const res = await api.policies.addRule(id, { toolPattern, kind, value, effect });
589
591
  if (json) return printJson(res), 0;
590
- if (res.deduped) err(green(" \u2713 ") + dim("Equivalent ALLOW rule already present."));
591
- 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})`));
592
594
  return 0;
593
595
  }
594
596
  case "revoke": {
@@ -597,7 +599,7 @@ async function run(argv) {
597
599
  if (!id || !ruleId) return err(" Usage: policy revoke <id> <ruleId>"), 1;
598
600
  const res = await api.policies.revokeRule(id, ruleId);
599
601
  if (json) return printJson(res), 0;
600
- err(green(` \u2713 Revoked ${ruleId}`) + dim(` \u2192 v${res.policy_version}`));
602
+ err(green(` \u2713 Revoked ${ruleId}`));
601
603
  return 0;
602
604
  }
603
605
  case "active": {
@@ -608,7 +610,7 @@ async function run(argv) {
608
610
  return 0;
609
611
  }
610
612
  err("");
611
- err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)} v${a.version}`);
613
+ err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)}`);
612
614
  err(` matched by: ${cyan(a.matched_by ?? "-")} self-protection: ${a.self_protection_enabled ? green("on") : dim("off")}`);
613
615
  const rl = a.security?.rateLimit;
614
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,16 +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 "allow": {
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 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;
11758
11759
  const toolPattern = flagStr(flags, "tool") ?? "*";
11759
11760
  let kind = "tool";
11760
11761
  let value;
@@ -11765,10 +11766,10 @@ async function run(argv) {
11765
11766
  value = v;
11766
11767
  }
11767
11768
  }
11768
- const res = await api.policies.addRule(id, { toolPattern, kind, value });
11769
+ const res = await api.policies.addRule(id, { toolPattern, kind, value, effect });
11769
11770
  if (json) return printJson(res), 0;
11770
- if (res.deduped) err(green(" \u2713 ") + dim("Equivalent ALLOW rule already present."));
11771
- 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})`));
11772
11773
  return 0;
11773
11774
  }
11774
11775
  case "revoke": {
@@ -11777,7 +11778,7 @@ async function run(argv) {
11777
11778
  if (!id || !ruleId) return err(" Usage: policy revoke <id> <ruleId>"), 1;
11778
11779
  const res = await api.policies.revokeRule(id, ruleId);
11779
11780
  if (json) return printJson(res), 0;
11780
- err(green(` \u2713 Revoked ${ruleId}`) + dim(` \u2192 v${res.policy_version}`));
11781
+ err(green(` \u2713 Revoked ${ruleId}`));
11781
11782
  return 0;
11782
11783
  }
11783
11784
  case "active": {
@@ -11788,7 +11789,7 @@ async function run(argv) {
11788
11789
  return 0;
11789
11790
  }
11790
11791
  err("");
11791
- err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)} v${a.version}`);
11792
+ err(` Active: ${bold(a.policy.name)} ${dim(`(${a.policy.id})`)}`);
11792
11793
  err(` matched by: ${cyan(a.matched_by ?? "-")} self-protection: ${a.self_protection_enabled ? green("on") : dim("off")}`);
11793
11794
  const rl = a.security?.rateLimit;
11794
11795
  if (rl) err(` rate limit: ${rl.perMinute}/min ${rl.perHour}/h ${rl.perDay}/day`);
@@ -11867,6 +11868,7 @@ var init_policy = __esm({
11867
11868
  ["policy list", "list all policies"],
11868
11869
  ["policy show <id>", "show one policy (rules, mode)"],
11869
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"],
11870
11872
  ["policy revoke <id> <ruleId>", "remove a rule"],
11871
11873
  ["policy active", "show the resolved active policy"],
11872
11874
  ["policy activate <id> | --clear", "pin / unpin the active policy"],
@@ -16244,6 +16246,7 @@ function printHelp() {
16244
16246
  cmd("policy list", "list all policies");
16245
16247
  cmd("policy show <id>", "show one policy (rules, mode)");
16246
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");
16247
16250
  cmd("policy revoke <id> <ruleId>", "remove a rule");
16248
16251
  cmd("policy activate <id> | --clear", "pin / unpin the active policy");
16249
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.37",
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": {