@node9/policy-engine 2.27.0-next.1 → 2.27.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.d.mts CHANGED
@@ -598,11 +598,6 @@ declare function isLockedCheck(def: CheckDef): boolean;
598
598
  /** Which check an SSRF floor hit belongs to: the strict-gated tiers are the
599
599
  * internal-address check, the rest are the locked metadata check. */
600
600
  declare function ssrfCheckId(tier: SsrfTier): string;
601
- /**
602
- * The check behind a rule name or a verdict label the code emits today.
603
- * Undefined for a user or organisation rule (`org:` and unnamed rules are
604
- * rules, not checks) and for a label no check claims.
605
- */
606
601
  declare function checkIdForRule(nameOrLabel: string | undefined): string | undefined;
607
602
  /** The check behind an audit row's `checkedBy` tag, for rows whose verdict
608
603
  * carried no rule name (the DLP, PII, loop and taint gates). */
package/dist/index.d.ts CHANGED
@@ -598,11 +598,6 @@ declare function isLockedCheck(def: CheckDef): boolean;
598
598
  /** Which check an SSRF floor hit belongs to: the strict-gated tiers are the
599
599
  * internal-address check, the rest are the locked metadata check. */
600
600
  declare function ssrfCheckId(tier: SsrfTier): string;
601
- /**
602
- * The check behind a rule name or a verdict label the code emits today.
603
- * Undefined for a user or organisation rule (`org:` and unnamed rules are
604
- * rules, not checks) and for a label no check claims.
605
- */
606
601
  declare function checkIdForRule(nameOrLabel: string | undefined): string | undefined;
607
602
  /** The check behind an audit row's `checkedBy` tag, for rows whose verdict
608
603
  * carried no rule name (the DLP, PII, loop and taint gates). */
package/dist/index.js CHANGED
@@ -6026,15 +6026,26 @@ function ssrfCheckId(tier) {
6026
6026
  return isStrictGatedTier(tier) ? "network.internal-addresses" : "network.metadata";
6027
6027
  }
6028
6028
  var PROJECT_JAIL_BLOCK_READ = /^shield:project-jail:block-read-(ssh|aws|env)(-any-tool)?$/;
6029
+ var OVERRIDE_PREFIX = "Override block rule:";
6030
+ var LABEL_WRAPPERS = ["Smart Rule:", "Node9 (AST):", "project-jail (AST):"];
6031
+ function unwrapRuleLabel(s) {
6032
+ let rest = s;
6033
+ const override = rest.lastIndexOf(OVERRIDE_PREFIX);
6034
+ if (override >= 0) rest = rest.slice(override + OVERRIDE_PREFIX.length).trimStart();
6035
+ for (const wrapper of LABEL_WRAPPERS) {
6036
+ if (!rest.startsWith(wrapper)) continue;
6037
+ const inner = rest.slice(wrapper.length).trim();
6038
+ return inner.length > 0 ? inner : void 0;
6039
+ }
6040
+ return void 0;
6041
+ }
6029
6042
  function checkIdForRule(nameOrLabel) {
6030
6043
  if (!nameOrLabel) return void 0;
6031
6044
  const s = nameOrLabel.trim();
6032
6045
  const exact = LEGACY_TO_ID.get(s);
6033
6046
  if (exact) return exact;
6034
- const wrapped = /^(?:.*Override block rule:\s*)?(?:Smart Rule|Node9 \(AST\)|project-jail \(AST\)):\s*(.+)$/.exec(
6035
- s
6036
- );
6037
- if (wrapped) return checkIdForRule(wrapped[1]);
6047
+ const unwrapped = unwrapRuleLabel(s);
6048
+ if (unwrapped !== void 0) return checkIdForRule(unwrapped);
6038
6049
  if (s.startsWith("shield:project-jail:")) {
6039
6050
  return PROJECT_JAIL_BLOCK_READ.test(s) ? "data.credential-files" : "data.credential-files-other";
6040
6051
  }
package/dist/index.mjs CHANGED
@@ -5848,15 +5848,26 @@ function ssrfCheckId(tier) {
5848
5848
  return isStrictGatedTier(tier) ? "network.internal-addresses" : "network.metadata";
5849
5849
  }
5850
5850
  var PROJECT_JAIL_BLOCK_READ = /^shield:project-jail:block-read-(ssh|aws|env)(-any-tool)?$/;
5851
+ var OVERRIDE_PREFIX = "Override block rule:";
5852
+ var LABEL_WRAPPERS = ["Smart Rule:", "Node9 (AST):", "project-jail (AST):"];
5853
+ function unwrapRuleLabel(s) {
5854
+ let rest = s;
5855
+ const override = rest.lastIndexOf(OVERRIDE_PREFIX);
5856
+ if (override >= 0) rest = rest.slice(override + OVERRIDE_PREFIX.length).trimStart();
5857
+ for (const wrapper of LABEL_WRAPPERS) {
5858
+ if (!rest.startsWith(wrapper)) continue;
5859
+ const inner = rest.slice(wrapper.length).trim();
5860
+ return inner.length > 0 ? inner : void 0;
5861
+ }
5862
+ return void 0;
5863
+ }
5851
5864
  function checkIdForRule(nameOrLabel) {
5852
5865
  if (!nameOrLabel) return void 0;
5853
5866
  const s = nameOrLabel.trim();
5854
5867
  const exact = LEGACY_TO_ID.get(s);
5855
5868
  if (exact) return exact;
5856
- const wrapped = /^(?:.*Override block rule:\s*)?(?:Smart Rule|Node9 \(AST\)|project-jail \(AST\)):\s*(.+)$/.exec(
5857
- s
5858
- );
5859
- if (wrapped) return checkIdForRule(wrapped[1]);
5869
+ const unwrapped = unwrapRuleLabel(s);
5870
+ if (unwrapped !== void 0) return checkIdForRule(unwrapped);
5860
5871
  if (s.startsWith("shield:project-jail:")) {
5861
5872
  return PROJECT_JAIL_BLOCK_READ.test(s) ? "data.credential-files" : "data.credential-files-other";
5862
5873
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/policy-engine",
3
- "version": "2.27.0-next.1",
3
+ "version": "2.27.0",
4
4
  "description": "Shared policy evaluation engine for node9 — DLP, smart rules, AST shell parsing, shields, loop detection. Pure functions, no I/O. Used by both node9-proxy and the node9 SaaS firewall.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://node9.ai",