@node9/policy-engine 2.6.2 → 2.7.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
@@ -202,6 +202,7 @@ declare function normalizeCommandForPolicy(command: string): string;
202
202
  declare function detectDangerousShellExec(command: string): 'block' | 'review' | null;
203
203
  /** @deprecated Use detectDangerousShellExec — kept for backwards compatibility */
204
204
  declare const detectDangerousEval: typeof detectDangerousShellExec;
205
+ declare const FS_READ_TOOLS: Set<string>;
205
206
  interface FsOpVerdict {
206
207
  ruleName: string;
207
208
  verdict: 'block' | 'review';
@@ -1043,8 +1044,6 @@ interface CanonicalFinding {
1043
1044
  occurrenceCount: number;
1044
1045
  /** AST findings: the path that triggered the verdict. */
1045
1046
  subjectPath?: string;
1046
- /** Loop findings: dollar cost so far. Loop-only today; optional everywhere. */
1047
- costUsd?: number;
1048
1047
  /** Loop findings: number of iterations. */
1049
1048
  loopCount?: number;
1050
1049
  loopKind?: 'loop' | 'long-iteration';
@@ -1143,7 +1142,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v9";
1143
1142
  * files changed, this hash must change too, and you must consciously
1144
1143
  * decide whether to bump CANONICAL_EXTRACTOR_VERSION."
1145
1144
  */
1146
- declare const CANONICAL_EXTRACTOR_HASH = "4ebf40dfe1d7c0a1";
1145
+ declare const CANONICAL_EXTRACTOR_HASH = "0d6c1ddb9a5af5b7";
1147
1146
  declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
1148
1147
  declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
1149
1148
  /**
@@ -1170,4 +1169,4 @@ declare function previewArgs(input: Record<string, unknown>, max: number): strin
1170
1169
  /** Engine version stamped on audit entries for future drift detection. */
1171
1170
  declare const ENGINE_VERSION = "1.4.0";
1172
1171
 
1173
- export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COST_PER_LOOP_ITER_USD, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestinations, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, parseAllSshHostsFromCommand, parseDestHost, previewArgs, redactText, resolvePinned, scanArgs, scanInjection, scanText, sensitivePathMatch, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, validateOverrides, validateRegex, validateShieldDefinition };
1172
+ export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COST_PER_LOOP_ITER_USD, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestinations, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, parseAllSshHostsFromCommand, parseDestHost, previewArgs, redactText, resolvePinned, scanArgs, scanInjection, scanText, sensitivePathMatch, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, validateOverrides, validateRegex, validateShieldDefinition };
package/dist/index.d.ts CHANGED
@@ -202,6 +202,7 @@ declare function normalizeCommandForPolicy(command: string): string;
202
202
  declare function detectDangerousShellExec(command: string): 'block' | 'review' | null;
203
203
  /** @deprecated Use detectDangerousShellExec — kept for backwards compatibility */
204
204
  declare const detectDangerousEval: typeof detectDangerousShellExec;
205
+ declare const FS_READ_TOOLS: Set<string>;
205
206
  interface FsOpVerdict {
206
207
  ruleName: string;
207
208
  verdict: 'block' | 'review';
@@ -1043,8 +1044,6 @@ interface CanonicalFinding {
1043
1044
  occurrenceCount: number;
1044
1045
  /** AST findings: the path that triggered the verdict. */
1045
1046
  subjectPath?: string;
1046
- /** Loop findings: dollar cost so far. Loop-only today; optional everywhere. */
1047
- costUsd?: number;
1048
1047
  /** Loop findings: number of iterations. */
1049
1048
  loopCount?: number;
1050
1049
  loopKind?: 'loop' | 'long-iteration';
@@ -1143,7 +1142,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v9";
1143
1142
  * files changed, this hash must change too, and you must consciously
1144
1143
  * decide whether to bump CANONICAL_EXTRACTOR_VERSION."
1145
1144
  */
1146
- declare const CANONICAL_EXTRACTOR_HASH = "4ebf40dfe1d7c0a1";
1145
+ declare const CANONICAL_EXTRACTOR_HASH = "0d6c1ddb9a5af5b7";
1147
1146
  declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
1148
1147
  declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
1149
1148
  /**
@@ -1170,4 +1169,4 @@ declare function previewArgs(input: Record<string, unknown>, max: number): strin
1170
1169
  /** Engine version stamped on audit entries for future drift detection. */
1171
1170
  declare const ENGINE_VERSION = "1.4.0";
1172
1171
 
1173
- export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COST_PER_LOOP_ITER_USD, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestinations, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, parseAllSshHostsFromCommand, parseDestHost, previewArgs, redactText, resolvePinned, scanArgs, scanInjection, scanText, sensitivePathMatch, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, validateOverrides, validateRegex, validateShieldDefinition };
1172
+ export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COST_PER_LOOP_ITER_USD, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestinations, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, parseAllSshHostsFromCommand, parseDestHost, previewArgs, redactText, resolvePinned, scanArgs, scanInjection, scanText, sensitivePathMatch, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, validateOverrides, validateRegex, validateShieldDefinition };
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ __export(src_exports, {
43
43
  ENGINE_VERSION: () => ENGINE_VERSION,
44
44
  FILE_TOOLS: () => FILE_TOOLS,
45
45
  FLAGS_WITH_VALUES: () => FLAGS_WITH_VALUES,
46
+ FS_READ_TOOLS: () => FS_READ_TOOLS,
46
47
  LONG_OUTPUT_THRESHOLD_BYTES: () => LONG_OUTPUT_THRESHOLD_BYTES,
47
48
  LOOP_MAX_RECORDS: () => LOOP_MAX_RECORDS,
48
49
  LOOP_THRESHOLD_FOR_WASTE: () => LOOP_THRESHOLD_FOR_WASTE,
@@ -3979,7 +3980,7 @@ function detectArgsPii(args) {
3979
3980
  // src/scan/canonical.ts
3980
3981
  var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
3981
3982
  var CANONICAL_EXTRACTOR_VERSION = "canonical-v9";
3982
- var CANONICAL_EXTRACTOR_HASH = "4ebf40dfe1d7c0a1";
3983
+ var CANONICAL_EXTRACTOR_HASH = "0d6c1ddb9a5af5b7";
3983
3984
  var DEDUPE_PREVIEW_LEN = 120;
3984
3985
  function extractCanonicalFindings(call, ctx) {
3985
3986
  const out = [];
@@ -4222,8 +4223,7 @@ function extractSessionLevelFindings(calls, ctx) {
4222
4223
  occurrenceCount: 1,
4223
4224
  loopCount: verdict.count,
4224
4225
  loopKind: "loop",
4225
- commandPreview: previewArgs(call.args, DEDUPE_PREVIEW_LEN),
4226
- costUsd: verdict.count * COST_PER_LOOP_ITER_USD
4226
+ commandPreview: previewArgs(call.args, DEDUPE_PREVIEW_LEN)
4227
4227
  });
4228
4228
  }
4229
4229
  return out;
@@ -4245,9 +4245,6 @@ function dedupeCanonicalFindings(findings) {
4245
4245
  if (f.lastSeenAt && f.lastSeenAt > prev.lastSeenAt) {
4246
4246
  prev.lastSeenAt = f.lastSeenAt;
4247
4247
  }
4248
- if (f.costUsd !== void 0) {
4249
- prev.costUsd = (prev.costUsd ?? 0) + f.costUsd;
4250
- }
4251
4248
  if (f.loopCount !== void 0) {
4252
4249
  prev.loopCount = (prev.loopCount ?? 0) + f.loopCount;
4253
4250
  }
@@ -4341,6 +4338,7 @@ var ENGINE_VERSION = "1.4.0";
4341
4338
  ENGINE_VERSION,
4342
4339
  FILE_TOOLS,
4343
4340
  FLAGS_WITH_VALUES,
4341
+ FS_READ_TOOLS,
4344
4342
  LONG_OUTPUT_THRESHOLD_BYTES,
4345
4343
  LOOP_MAX_RECORDS,
4346
4344
  LOOP_THRESHOLD_FOR_WASTE,
package/dist/index.mjs CHANGED
@@ -3865,7 +3865,7 @@ function detectArgsPii(args) {
3865
3865
  // src/scan/canonical.ts
3866
3866
  var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
3867
3867
  var CANONICAL_EXTRACTOR_VERSION = "canonical-v9";
3868
- var CANONICAL_EXTRACTOR_HASH = "4ebf40dfe1d7c0a1";
3868
+ var CANONICAL_EXTRACTOR_HASH = "0d6c1ddb9a5af5b7";
3869
3869
  var DEDUPE_PREVIEW_LEN = 120;
3870
3870
  function extractCanonicalFindings(call, ctx) {
3871
3871
  const out = [];
@@ -4108,8 +4108,7 @@ function extractSessionLevelFindings(calls, ctx) {
4108
4108
  occurrenceCount: 1,
4109
4109
  loopCount: verdict.count,
4110
4110
  loopKind: "loop",
4111
- commandPreview: previewArgs(call.args, DEDUPE_PREVIEW_LEN),
4112
- costUsd: verdict.count * COST_PER_LOOP_ITER_USD
4111
+ commandPreview: previewArgs(call.args, DEDUPE_PREVIEW_LEN)
4113
4112
  });
4114
4113
  }
4115
4114
  return out;
@@ -4131,9 +4130,6 @@ function dedupeCanonicalFindings(findings) {
4131
4130
  if (f.lastSeenAt && f.lastSeenAt > prev.lastSeenAt) {
4132
4131
  prev.lastSeenAt = f.lastSeenAt;
4133
4132
  }
4134
- if (f.costUsd !== void 0) {
4135
- prev.costUsd = (prev.costUsd ?? 0) + f.costUsd;
4136
- }
4137
4133
  if (f.loopCount !== void 0) {
4138
4134
  prev.loopCount = (prev.loopCount ?? 0) + f.loopCount;
4139
4135
  }
@@ -4226,6 +4222,7 @@ export {
4226
4222
  ENGINE_VERSION,
4227
4223
  FILE_TOOLS,
4228
4224
  FLAGS_WITH_VALUES,
4225
+ FS_READ_TOOLS,
4229
4226
  LONG_OUTPUT_THRESHOLD_BYTES,
4230
4227
  LOOP_MAX_RECORDS,
4231
4228
  LOOP_THRESHOLD_FOR_WASTE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/policy-engine",
3
- "version": "2.6.2",
3
+ "version": "2.7.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",