@node9/policy-engine 2.38.0 → 2.40.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
@@ -393,7 +393,8 @@ interface ResolvedCheck {
393
393
  * The value in force for one check, read from today's config shape, and
394
394
  * where it came from. A locked check always answers its floor. A pack row is
395
395
  * `off` unless its pack is applied. Anything the config does not set is the
396
- * catalog default.
396
+ * default of the level `settings.mode` names (levels.ts), which for most
397
+ * checks is the catalog default.
397
398
  */
398
399
  declare function resolveCheck(settings: CatalogSettings, id: string): ResolvedCheck | undefined;
399
400
  /** Every check resolved, in catalog order. */
@@ -1217,6 +1218,15 @@ declare function checksFromLegacyPolicy(policy: LegacyPolicyKnobs, mode?: string
1217
1218
  * legacy shape cannot carry the value.
1218
1219
  */
1219
1220
  declare function checkToLegacyPolicy(policy: Obj, id: string, v: Verdict): boolean;
1221
+ /**
1222
+ * The knob-governed checks a legacy policy block STATES: it sets the field
1223
+ * that picks the check's value. Presence, not value, decides, so a level
1224
+ * (levels.ts) leaves the check alone. A field that turns a check on without
1225
+ * choosing between its on values (`dlp.enabled: true` for the weak-credential
1226
+ * row, `untrustedContent.enabled: true`) does not pin it: older `node9 init`
1227
+ * runs wrote those into every config file.
1228
+ */
1229
+ declare function knobStatedChecks(policy: LegacyPolicyKnobs): Set<string>;
1220
1230
  /**
1221
1231
  * Checks whose detector reads the resolved checks map: every value the
1222
1232
  * catalog row offers works. Pack rows (`packs.*`) qualify too.
@@ -1239,6 +1249,37 @@ declare function configurableValues(id: string): readonly Verdict[];
1239
1249
  /** The ids a config file or a workspace can state today. */
1240
1250
  declare const CONFIGURABLE_CHECK_IDS: readonly string[];
1241
1251
 
1252
+ declare const LEVELS: readonly ["audit", "soft", "standard", "strict", "block-all"];
1253
+ type Level = (typeof LEVELS)[number];
1254
+ /** Every value `settings.mode` accepts: the five levels plus `observe`, the
1255
+ * older name of Audit that the dashboard still stores. */
1256
+ declare const MODE_VALUES: readonly ["observe", "audit", "soft", "standard", "strict", "block-all"];
1257
+ type ModeValue = (typeof MODE_VALUES)[number];
1258
+ declare function isModeValue(v: unknown): v is ModeValue;
1259
+ /** The level a mode names. `observe` is Audit; anything unknown or unset is
1260
+ * Standard, the default of every install. */
1261
+ declare function levelOf(mode: string | undefined): Level;
1262
+ /** Audit: nothing is stopped; every check records what it would have done. */
1263
+ declare function isRecordOnly(mode: string | undefined): boolean;
1264
+ /** Strict and Block all ask about every inline code call, not only the
1265
+ * dangerous ones the inline judge finds. */
1266
+ declare function reviewsEveryInline(mode: string | undefined): boolean;
1267
+ /** Block all: ask before any call no check recognised (the catch-all,
1268
+ * `commands.unknown`) and about a binary of unknown origin. This is what
1269
+ * `strict` meant before the levels. */
1270
+ declare function isBlockAll(mode: string | undefined): boolean;
1271
+ /** The value a level gives a check nobody stated, or undefined when the
1272
+ * level keeps the catalog default. */
1273
+ declare function levelCheckValue(mode: string | undefined, id: string): Verdict | undefined;
1274
+ /** Every check a level changes, with its value. */
1275
+ declare function levelChecks(mode: string | undefined): Readonly<Record<string, Verdict>>;
1276
+ /** The package registry signals (`loading.malicious-package` tuning), which
1277
+ * allow only review or off. Soft turns both off; the others keep review. */
1278
+ declare function levelPackageSignals(mode: string | undefined): {
1279
+ newPackage: 'review' | 'off';
1280
+ installScript: 'review' | 'off';
1281
+ } | undefined;
1282
+
1242
1283
  interface PipeChainAnalysis {
1243
1284
  isPipeline: boolean;
1244
1285
  hasSensitiveSource: boolean;
@@ -2333,5 +2374,5 @@ declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
2333
2374
  /** Engine version stamped on audit entries for future drift detection. */
2334
2375
  declare const ENGINE_VERSION = "1.4.0";
2335
2376
 
2336
- export { ACTION_CHECKS, ACTION_TEMPLATES, AGENT_INSTRUCTION_DIRS, AGENT_INSTRUCTION_FILES, APP_SERVER_GLOB, APP_SHIELD_NAMES, APP_SHIELD_SPECS, ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, CHECKS, CHECK_BY_ID, CHECK_GROUPS, CHECK_TEXT, CHECK_VERDICT_RANK, COMMAND_WRAPPERS, CONFIGURABLE_CHECK_IDS, COPY_VERBS, COST_PER_LOOP_ITER_USD, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, ENGINE_VERSION, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, GENERAL_ACTION_RULES, KNOB_GOVERNED, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, MAP_GOVERNED, MAX_BLAST_PATH, MAX_DESTINATIONS, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, REALTIME_PII_PATTERNS, REPLACED_SHIELDS, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, TUNING_FIELDS, VERDICTS, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, argumentLeavesText, catalogSettingsFromConfig, checkDangerousSql, checkIdForCheckedBy, checkIdForRule, checkToLegacyPolicy, checkValue, checksFromLegacyPolicy, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifyShellExposure, classifySsrf, collectFileAccesses, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, configurableValues, decodeEmbeddedBase64, decodeEmbeddedHex, dedupeCanonicalFindings, destinationDomain, destinationKind, destinationValue, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, entryDisplay, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileAccessView, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hashDestination, hostMatches, incompleteFileVerdict, inlineExecDescription, inlineExecReason, inlineExecReview, inspectArgumentSecrets, inspectionEntry, inspectionLayers, isAgentInstructionPath, isBashTool, isDestructiveToolName, isHashedEntry, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isMaskedKind, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, maskDestination, maskPersonalData, maskPersonalValue, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, matchesTrustedEntry, matchesTrustedList, mcpServerFromToolName, narrativeRuleLabel, normalizeCommandForPolicy, normalizeDestination, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, normalizeRecipient, normalizeTrustedEntry, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, ruleServerMatches, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, shellScriptOperands, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, suggestFromApprovals, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, trustedEntryOf, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, unwrapRuleLabel, validateOverrides, validateRegex, validateShieldDefinition };
2337
- export type { ActionTemplateName, ApprovalRow, ArgumentInspectionResult, AuditEntryForClassify, BlastEnvFinding, BlastFinding, BlastResult, BlastSummary, CanaryHit, CanaryValue, CanaryView, CanonicalAgent, CanonicalFinding, CanonicalFindingType, CanonicalSourceType, CatalogSettings, CheckDef, CheckGroup, CheckSource, CheckText, Destination, DestinationKind, DlpMatch, EgressPolicy, EgressVerdict, ExtractContext, FileAccess, FileAccessContext, FsOpVerdict, InjectionConfidence, InjectionContext, InjectionMatch, InlineExecReview, InspectionInput, InspectionLayers, LegacyPolicyKnobs, LoopWindowEvaluation, PackageEcosystem, PackageInstallRequest, PiiPattern, PipeChainAnalysis, PolicyConfig, PolicyContext, PolicyHostHooks, PolicyVerdict, PositionedArg, ProtectedFileVerdict, ProvenanceLookup, ProvenanceTrust, ResolvedCheck, RiskMetadata, ScanFinding, ScanSignals, ScanSummary, ScanView, ScoreTier, SessionExtractContext, SessionToolCall, Severity, ShellCommandAnalysis, ShellDestToken, ShellDestination, ShellExposure, ShellInputResolution, ShieldDefinition, ShieldOverrides, ShieldVerdict, SmartCondition, SmartRule, SsrfFloorOptions, SsrfMatch, SsrfTier, SsrfVerdict, SuggestOptions, Suggestion, ToolCallEntry, ToolCallRecord, ToolInspection, ToolInspectionEntry, TuningField, Verdict };
2377
+ export { ACTION_CHECKS, ACTION_TEMPLATES, AGENT_INSTRUCTION_DIRS, AGENT_INSTRUCTION_FILES, APP_SERVER_GLOB, APP_SHIELD_NAMES, APP_SHIELD_SPECS, ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, CHECKS, CHECK_BY_ID, CHECK_GROUPS, CHECK_TEXT, CHECK_VERDICT_RANK, COMMAND_WRAPPERS, CONFIGURABLE_CHECK_IDS, COPY_VERBS, COST_PER_LOOP_ITER_USD, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, ENGINE_VERSION, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, GENERAL_ACTION_RULES, KNOB_GOVERNED, LEVELS, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, MAP_GOVERNED, MAX_BLAST_PATH, MAX_DESTINATIONS, MODE_VALUES, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, REALTIME_PII_PATTERNS, REPLACED_SHIELDS, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, TUNING_FIELDS, VERDICTS, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, argumentLeavesText, catalogSettingsFromConfig, checkDangerousSql, checkIdForCheckedBy, checkIdForRule, checkToLegacyPolicy, checkValue, checksFromLegacyPolicy, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifyShellExposure, classifySsrf, collectFileAccesses, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, configurableValues, decodeEmbeddedBase64, decodeEmbeddedHex, dedupeCanonicalFindings, destinationDomain, destinationKind, destinationValue, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, entryDisplay, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileAccessView, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hashDestination, hostMatches, incompleteFileVerdict, inlineExecDescription, inlineExecReason, inlineExecReview, inspectArgumentSecrets, inspectionEntry, inspectionLayers, isAgentInstructionPath, isBashTool, isBlockAll, isDestructiveToolName, isHashedEntry, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isMaskedKind, isModeValue, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isRecordOnly, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, knobStatedChecks, levelCheckValue, levelChecks, levelOf, levelPackageSignals, maskDestination, maskPersonalData, maskPersonalValue, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, matchesTrustedEntry, matchesTrustedList, mcpServerFromToolName, narrativeRuleLabel, normalizeCommandForPolicy, normalizeDestination, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, normalizeRecipient, normalizeTrustedEntry, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, reviewsEveryInline, ruleServerMatches, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, shellScriptOperands, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, suggestFromApprovals, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, trustedEntryOf, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, unwrapRuleLabel, validateOverrides, validateRegex, validateShieldDefinition };
2378
+ export type { ActionTemplateName, ApprovalRow, ArgumentInspectionResult, AuditEntryForClassify, BlastEnvFinding, BlastFinding, BlastResult, BlastSummary, CanaryHit, CanaryValue, CanaryView, CanonicalAgent, CanonicalFinding, CanonicalFindingType, CanonicalSourceType, CatalogSettings, CheckDef, CheckGroup, CheckSource, CheckText, Destination, DestinationKind, DlpMatch, EgressPolicy, EgressVerdict, ExtractContext, FileAccess, FileAccessContext, FsOpVerdict, InjectionConfidence, InjectionContext, InjectionMatch, InlineExecReview, InspectionInput, InspectionLayers, LegacyPolicyKnobs, Level, LoopWindowEvaluation, ModeValue, PackageEcosystem, PackageInstallRequest, PiiPattern, PipeChainAnalysis, PolicyConfig, PolicyContext, PolicyHostHooks, PolicyVerdict, PositionedArg, ProtectedFileVerdict, ProvenanceLookup, ProvenanceTrust, ResolvedCheck, RiskMetadata, ScanFinding, ScanSignals, ScanSummary, ScanView, ScoreTier, SessionExtractContext, SessionToolCall, Severity, ShellCommandAnalysis, ShellDestToken, ShellDestination, ShellExposure, ShellInputResolution, ShieldDefinition, ShieldOverrides, ShieldVerdict, SmartCondition, SmartRule, SsrfFloorOptions, SsrfMatch, SsrfTier, SsrfVerdict, SuggestOptions, Suggestion, ToolCallEntry, ToolCallRecord, ToolInspection, ToolInspectionEntry, TuningField, Verdict };
package/dist/index.d.ts CHANGED
@@ -393,7 +393,8 @@ interface ResolvedCheck {
393
393
  * The value in force for one check, read from today's config shape, and
394
394
  * where it came from. A locked check always answers its floor. A pack row is
395
395
  * `off` unless its pack is applied. Anything the config does not set is the
396
- * catalog default.
396
+ * default of the level `settings.mode` names (levels.ts), which for most
397
+ * checks is the catalog default.
397
398
  */
398
399
  declare function resolveCheck(settings: CatalogSettings, id: string): ResolvedCheck | undefined;
399
400
  /** Every check resolved, in catalog order. */
@@ -1217,6 +1218,15 @@ declare function checksFromLegacyPolicy(policy: LegacyPolicyKnobs, mode?: string
1217
1218
  * legacy shape cannot carry the value.
1218
1219
  */
1219
1220
  declare function checkToLegacyPolicy(policy: Obj, id: string, v: Verdict): boolean;
1221
+ /**
1222
+ * The knob-governed checks a legacy policy block STATES: it sets the field
1223
+ * that picks the check's value. Presence, not value, decides, so a level
1224
+ * (levels.ts) leaves the check alone. A field that turns a check on without
1225
+ * choosing between its on values (`dlp.enabled: true` for the weak-credential
1226
+ * row, `untrustedContent.enabled: true`) does not pin it: older `node9 init`
1227
+ * runs wrote those into every config file.
1228
+ */
1229
+ declare function knobStatedChecks(policy: LegacyPolicyKnobs): Set<string>;
1220
1230
  /**
1221
1231
  * Checks whose detector reads the resolved checks map: every value the
1222
1232
  * catalog row offers works. Pack rows (`packs.*`) qualify too.
@@ -1239,6 +1249,37 @@ declare function configurableValues(id: string): readonly Verdict[];
1239
1249
  /** The ids a config file or a workspace can state today. */
1240
1250
  declare const CONFIGURABLE_CHECK_IDS: readonly string[];
1241
1251
 
1252
+ declare const LEVELS: readonly ["audit", "soft", "standard", "strict", "block-all"];
1253
+ type Level = (typeof LEVELS)[number];
1254
+ /** Every value `settings.mode` accepts: the five levels plus `observe`, the
1255
+ * older name of Audit that the dashboard still stores. */
1256
+ declare const MODE_VALUES: readonly ["observe", "audit", "soft", "standard", "strict", "block-all"];
1257
+ type ModeValue = (typeof MODE_VALUES)[number];
1258
+ declare function isModeValue(v: unknown): v is ModeValue;
1259
+ /** The level a mode names. `observe` is Audit; anything unknown or unset is
1260
+ * Standard, the default of every install. */
1261
+ declare function levelOf(mode: string | undefined): Level;
1262
+ /** Audit: nothing is stopped; every check records what it would have done. */
1263
+ declare function isRecordOnly(mode: string | undefined): boolean;
1264
+ /** Strict and Block all ask about every inline code call, not only the
1265
+ * dangerous ones the inline judge finds. */
1266
+ declare function reviewsEveryInline(mode: string | undefined): boolean;
1267
+ /** Block all: ask before any call no check recognised (the catch-all,
1268
+ * `commands.unknown`) and about a binary of unknown origin. This is what
1269
+ * `strict` meant before the levels. */
1270
+ declare function isBlockAll(mode: string | undefined): boolean;
1271
+ /** The value a level gives a check nobody stated, or undefined when the
1272
+ * level keeps the catalog default. */
1273
+ declare function levelCheckValue(mode: string | undefined, id: string): Verdict | undefined;
1274
+ /** Every check a level changes, with its value. */
1275
+ declare function levelChecks(mode: string | undefined): Readonly<Record<string, Verdict>>;
1276
+ /** The package registry signals (`loading.malicious-package` tuning), which
1277
+ * allow only review or off. Soft turns both off; the others keep review. */
1278
+ declare function levelPackageSignals(mode: string | undefined): {
1279
+ newPackage: 'review' | 'off';
1280
+ installScript: 'review' | 'off';
1281
+ } | undefined;
1282
+
1242
1283
  interface PipeChainAnalysis {
1243
1284
  isPipeline: boolean;
1244
1285
  hasSensitiveSource: boolean;
@@ -2333,5 +2374,5 @@ declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
2333
2374
  /** Engine version stamped on audit entries for future drift detection. */
2334
2375
  declare const ENGINE_VERSION = "1.4.0";
2335
2376
 
2336
- export { ACTION_CHECKS, ACTION_TEMPLATES, AGENT_INSTRUCTION_DIRS, AGENT_INSTRUCTION_FILES, APP_SERVER_GLOB, APP_SHIELD_NAMES, APP_SHIELD_SPECS, ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, CHECKS, CHECK_BY_ID, CHECK_GROUPS, CHECK_TEXT, CHECK_VERDICT_RANK, COMMAND_WRAPPERS, CONFIGURABLE_CHECK_IDS, COPY_VERBS, COST_PER_LOOP_ITER_USD, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, ENGINE_VERSION, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, GENERAL_ACTION_RULES, KNOB_GOVERNED, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, MAP_GOVERNED, MAX_BLAST_PATH, MAX_DESTINATIONS, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, REALTIME_PII_PATTERNS, REPLACED_SHIELDS, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, TUNING_FIELDS, VERDICTS, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, argumentLeavesText, catalogSettingsFromConfig, checkDangerousSql, checkIdForCheckedBy, checkIdForRule, checkToLegacyPolicy, checkValue, checksFromLegacyPolicy, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifyShellExposure, classifySsrf, collectFileAccesses, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, configurableValues, decodeEmbeddedBase64, decodeEmbeddedHex, dedupeCanonicalFindings, destinationDomain, destinationKind, destinationValue, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, entryDisplay, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileAccessView, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hashDestination, hostMatches, incompleteFileVerdict, inlineExecDescription, inlineExecReason, inlineExecReview, inspectArgumentSecrets, inspectionEntry, inspectionLayers, isAgentInstructionPath, isBashTool, isDestructiveToolName, isHashedEntry, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isMaskedKind, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, maskDestination, maskPersonalData, maskPersonalValue, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, matchesTrustedEntry, matchesTrustedList, mcpServerFromToolName, narrativeRuleLabel, normalizeCommandForPolicy, normalizeDestination, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, normalizeRecipient, normalizeTrustedEntry, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, ruleServerMatches, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, shellScriptOperands, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, suggestFromApprovals, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, trustedEntryOf, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, unwrapRuleLabel, validateOverrides, validateRegex, validateShieldDefinition };
2337
- export type { ActionTemplateName, ApprovalRow, ArgumentInspectionResult, AuditEntryForClassify, BlastEnvFinding, BlastFinding, BlastResult, BlastSummary, CanaryHit, CanaryValue, CanaryView, CanonicalAgent, CanonicalFinding, CanonicalFindingType, CanonicalSourceType, CatalogSettings, CheckDef, CheckGroup, CheckSource, CheckText, Destination, DestinationKind, DlpMatch, EgressPolicy, EgressVerdict, ExtractContext, FileAccess, FileAccessContext, FsOpVerdict, InjectionConfidence, InjectionContext, InjectionMatch, InlineExecReview, InspectionInput, InspectionLayers, LegacyPolicyKnobs, LoopWindowEvaluation, PackageEcosystem, PackageInstallRequest, PiiPattern, PipeChainAnalysis, PolicyConfig, PolicyContext, PolicyHostHooks, PolicyVerdict, PositionedArg, ProtectedFileVerdict, ProvenanceLookup, ProvenanceTrust, ResolvedCheck, RiskMetadata, ScanFinding, ScanSignals, ScanSummary, ScanView, ScoreTier, SessionExtractContext, SessionToolCall, Severity, ShellCommandAnalysis, ShellDestToken, ShellDestination, ShellExposure, ShellInputResolution, ShieldDefinition, ShieldOverrides, ShieldVerdict, SmartCondition, SmartRule, SsrfFloorOptions, SsrfMatch, SsrfTier, SsrfVerdict, SuggestOptions, Suggestion, ToolCallEntry, ToolCallRecord, ToolInspection, ToolInspectionEntry, TuningField, Verdict };
2377
+ export { ACTION_CHECKS, ACTION_TEMPLATES, AGENT_INSTRUCTION_DIRS, AGENT_INSTRUCTION_FILES, APP_SERVER_GLOB, APP_SHIELD_NAMES, APP_SHIELD_SPECS, ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, CHECKS, CHECK_BY_ID, CHECK_GROUPS, CHECK_TEXT, CHECK_VERDICT_RANK, COMMAND_WRAPPERS, CONFIGURABLE_CHECK_IDS, COPY_VERBS, COST_PER_LOOP_ITER_USD, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, ENGINE_VERSION, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, GENERAL_ACTION_RULES, KNOB_GOVERNED, LEVELS, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, MAP_GOVERNED, MAX_BLAST_PATH, MAX_DESTINATIONS, MODE_VALUES, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, REALTIME_PII_PATTERNS, REPLACED_SHIELDS, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, TUNING_FIELDS, VERDICTS, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, argumentLeavesText, catalogSettingsFromConfig, checkDangerousSql, checkIdForCheckedBy, checkIdForRule, checkToLegacyPolicy, checkValue, checksFromLegacyPolicy, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifyShellExposure, classifySsrf, collectFileAccesses, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, configurableValues, decodeEmbeddedBase64, decodeEmbeddedHex, dedupeCanonicalFindings, destinationDomain, destinationKind, destinationValue, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, entryDisplay, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileAccessView, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hashDestination, hostMatches, incompleteFileVerdict, inlineExecDescription, inlineExecReason, inlineExecReview, inspectArgumentSecrets, inspectionEntry, inspectionLayers, isAgentInstructionPath, isBashTool, isBlockAll, isDestructiveToolName, isHashedEntry, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isMaskedKind, isModeValue, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isRecordOnly, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, knobStatedChecks, levelCheckValue, levelChecks, levelOf, levelPackageSignals, maskDestination, maskPersonalData, maskPersonalValue, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, matchesTrustedEntry, matchesTrustedList, mcpServerFromToolName, narrativeRuleLabel, normalizeCommandForPolicy, normalizeDestination, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, normalizeRecipient, normalizeTrustedEntry, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, reviewsEveryInline, ruleServerMatches, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, shellScriptOperands, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, suggestFromApprovals, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, trustedEntryOf, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, unwrapRuleLabel, validateOverrides, validateRegex, validateShieldDefinition };
2378
+ export type { ActionTemplateName, ApprovalRow, ArgumentInspectionResult, AuditEntryForClassify, BlastEnvFinding, BlastFinding, BlastResult, BlastSummary, CanaryHit, CanaryValue, CanaryView, CanonicalAgent, CanonicalFinding, CanonicalFindingType, CanonicalSourceType, CatalogSettings, CheckDef, CheckGroup, CheckSource, CheckText, Destination, DestinationKind, DlpMatch, EgressPolicy, EgressVerdict, ExtractContext, FileAccess, FileAccessContext, FsOpVerdict, InjectionConfidence, InjectionContext, InjectionMatch, InlineExecReview, InspectionInput, InspectionLayers, LegacyPolicyKnobs, Level, LoopWindowEvaluation, ModeValue, PackageEcosystem, PackageInstallRequest, PiiPattern, PipeChainAnalysis, PolicyConfig, PolicyContext, PolicyHostHooks, PolicyVerdict, PositionedArg, ProtectedFileVerdict, ProvenanceLookup, ProvenanceTrust, ResolvedCheck, RiskMetadata, ScanFinding, ScanSignals, ScanSummary, ScanView, ScoreTier, SessionExtractContext, SessionToolCall, Severity, ShellCommandAnalysis, ShellDestToken, ShellDestination, ShellExposure, ShellInputResolution, ShieldDefinition, ShieldOverrides, ShieldVerdict, SmartCondition, SmartRule, SsrfFloorOptions, SsrfMatch, SsrfTier, SsrfVerdict, SuggestOptions, Suggestion, ToolCallEntry, ToolCallRecord, ToolInspection, ToolInspectionEntry, TuningField, Verdict };
package/dist/index.js CHANGED
@@ -65,12 +65,14 @@ __export(src_exports, {
65
65
  FS_READ_TOOLS: () => FS_READ_TOOLS,
66
66
  GENERAL_ACTION_RULES: () => GENERAL_ACTION_RULES,
67
67
  KNOB_GOVERNED: () => KNOB_GOVERNED,
68
+ LEVELS: () => LEVELS,
68
69
  LONG_OUTPUT_THRESHOLD_BYTES: () => LONG_OUTPUT_THRESHOLD_BYTES,
69
70
  LOOP_MAX_RECORDS: () => LOOP_MAX_RECORDS,
70
71
  LOOP_THRESHOLD_FOR_WASTE: () => LOOP_THRESHOLD_FOR_WASTE,
71
72
  MAP_GOVERNED: () => MAP_GOVERNED,
72
73
  MAX_BLAST_PATH: () => MAX_BLAST_PATH,
73
74
  MAX_DESTINATIONS: () => MAX_DESTINATIONS,
75
+ MODE_VALUES: () => MODE_VALUES,
74
76
  NET_BINARIES: () => NET_BINARIES,
75
77
  PATTERN_VERB_NAMES: () => PATTERN_VERB_NAMES,
76
78
  PRIVILEGE_ESCALATION_RE: () => PRIVILEGE_ESCALATION_RE,
@@ -155,6 +157,7 @@ __export(src_exports, {
155
157
  inspectionLayers: () => inspectionLayers,
156
158
  isAgentInstructionPath: () => isAgentInstructionPath,
157
159
  isBashTool: () => isBashTool,
160
+ isBlockAll: () => isBlockAll,
158
161
  isDestructiveToolName: () => isDestructiveToolName,
159
162
  isHashedEntry: () => isHashedEntry,
160
163
  isIgnoredTool: () => isIgnoredTool,
@@ -164,13 +167,20 @@ __export(src_exports, {
164
167
  isLockedCheck: () => isLockedCheck,
165
168
  isLoopbackHost: () => isLoopbackHost,
166
169
  isMaskedKind: () => isMaskedKind,
170
+ isModeValue: () => isModeValue,
167
171
  isPasswordHashPath: () => isPasswordHashPath,
168
172
  isPrivateHost: () => isPrivateHost,
169
173
  isProtectedHomePath: () => isProtectedHomePath,
174
+ isRecordOnly: () => isRecordOnly,
170
175
  isShellShapedTool: () => isShellShapedTool,
171
176
  isShieldVerdict: () => isShieldVerdict,
172
177
  isStrictGatedTier: () => isStrictGatedTier,
173
178
  isVerdict: () => isVerdict,
179
+ knobStatedChecks: () => knobStatedChecks,
180
+ levelCheckValue: () => levelCheckValue,
181
+ levelChecks: () => levelChecks,
182
+ levelOf: () => levelOf,
183
+ levelPackageSignals: () => levelPackageSignals,
174
184
  maskDestination: () => maskDestination,
175
185
  maskPersonalData: () => maskPersonalData,
176
186
  maskPersonalValue: () => maskPersonalValue,
@@ -201,6 +211,7 @@ __export(src_exports, {
201
211
  resolveCheckMap: () => resolveCheckMap,
202
212
  resolvePinned: () => resolvePinned,
203
213
  resolveShellInput: () => resolveShellInput,
214
+ reviewsEveryInline: () => reviewsEveryInline,
204
215
  ruleServerMatches: () => ruleServerMatches,
205
216
  safeMessage: () => safeMessage,
206
217
  sampleCopyCommand: () => sampleCopyCommand,
@@ -2286,7 +2297,7 @@ var CHECK_TEXT = {
2286
2297
  "actions.money": {
2287
2298
  plain: "The agent moves money (a refund, a payout, a transfer, a charge) through an app node9 has no protection for, such as an internal billing server.",
2288
2299
  example: "refund_order on a server called acme-billing",
2289
- advice: "Keep Review. When the app is Stripe or PayPal, turn on its own protection instead: it covers the CLI, the API and scripts too, and a call from it no longer comes here."
2300
+ advice: "Standard records these and Strict asks. Set Review to be asked before every money move at any level. When the app is Stripe or PayPal, turn on its own protection instead: it covers the CLI, the API and scripts too, and a call from it no longer comes here."
2290
2301
  },
2291
2302
  "actions.access": {
2292
2303
  plain: "The agent changes a password, a key, a role or who belongs to a team, through an app node9 has no protection for.",
@@ -2464,6 +2475,82 @@ var CHECK_TEXT = {
2464
2475
  }
2465
2476
  };
2466
2477
 
2478
+ // src/levels.ts
2479
+ var LEVELS = ["audit", "soft", "standard", "strict", "block-all"];
2480
+ var MODE_VALUES = ["observe", ...LEVELS];
2481
+ function isModeValue(v) {
2482
+ return typeof v === "string" && MODE_VALUES.includes(v);
2483
+ }
2484
+ function levelOf(mode) {
2485
+ if (mode === "observe") return "audit";
2486
+ return LEVELS.includes(mode ?? "") ? mode : "standard";
2487
+ }
2488
+ function isRecordOnly(mode) {
2489
+ return levelOf(mode) === "audit";
2490
+ }
2491
+ function reviewsEveryInline(mode) {
2492
+ const level = levelOf(mode);
2493
+ return level === "strict" || level === "block-all";
2494
+ }
2495
+ function isBlockAll(mode) {
2496
+ return levelOf(mode) === "block-all";
2497
+ }
2498
+ var SOFT = {
2499
+ "commands.inline-exec": "log",
2500
+ "commands.eval-dynamic": "log",
2501
+ "commands.rm": "log",
2502
+ "commands.chmod": "log",
2503
+ "commands.sudo": "log",
2504
+ "commands.git-destructive": "log",
2505
+ "commands.sql-ddl": "log",
2506
+ "commands.sql-no-where": "log",
2507
+ "commands.temp-binary": "log",
2508
+ "commands.disk-destroy": "log",
2509
+ "commands.dangerous-word": "log",
2510
+ "files.system-dirs": "log",
2511
+ "files.shell-startup": "log",
2512
+ "files.password-hashes": "log",
2513
+ "data.pipe-chain": "log",
2514
+ "behavior.untrusted-content": "log"
2515
+ };
2516
+ var STRICT = {
2517
+ "commands.sql-ddl": "block",
2518
+ "commands.disk-destroy": "block",
2519
+ "commands.node9-disarm": "block",
2520
+ "files.system-dirs": "block",
2521
+ "files.shell-startup": "block",
2522
+ "files.password-hashes": "block",
2523
+ "data.secrets-weak": "block",
2524
+ "data.pipe-chain": "block",
2525
+ "network.unknown-host": "review",
2526
+ "network.internal-addresses": "block",
2527
+ "behavior.prompt-injection": "log",
2528
+ "loading.skill-tamper": "block",
2529
+ // Standard records money moves (catalog default log); Strict asks.
2530
+ "actions.money": "review"
2531
+ };
2532
+ var BLOCK_ALL = {
2533
+ ...STRICT,
2534
+ "commands.unknown": "review",
2535
+ "commands.temp-binary": "block"
2536
+ };
2537
+ var LEVEL_CHECKS = {
2538
+ audit: {},
2539
+ soft: SOFT,
2540
+ standard: {},
2541
+ strict: STRICT,
2542
+ "block-all": BLOCK_ALL
2543
+ };
2544
+ function levelCheckValue(mode, id) {
2545
+ return LEVEL_CHECKS[levelOf(mode)][id];
2546
+ }
2547
+ function levelChecks(mode) {
2548
+ return LEVEL_CHECKS[levelOf(mode)];
2549
+ }
2550
+ function levelPackageSignals(mode) {
2551
+ return levelOf(mode) === "soft" ? { newPackage: "off", installScript: "off" } : void 0;
2552
+ }
2553
+
2467
2554
  // src/catalog.ts
2468
2555
  var VERDICTS = ["off", "log", "review", "block"];
2469
2556
  var CHECK_VERDICT_RANK = { off: 0, log: 1, review: 2, block: 3 };
@@ -2893,7 +2980,10 @@ var PRODUCT_CHECKS = [
2893
2980
  title: "Money moves",
2894
2981
  catches: "a refund, payout, transfer, charge or withdrawal through an app with no protection of its own",
2895
2982
  values: ALL,
2896
- defaultValue: "review",
2983
+ // Founder decision 2026-10-25: a transfer the user asked for is ordinary
2984
+ // work. Standard records it; Strict asks (levels.ts); a user who wants to
2985
+ // be asked states review.
2986
+ defaultValue: "log",
2897
2987
  legacy: generalActionRuleNames("finance")
2898
2988
  },
2899
2989
  {
@@ -3070,7 +3160,7 @@ var LEGACY_READERS = {
3070
3160
  "commands.rm": (s) => knob(s.commandChecks?.rmAdvisory),
3071
3161
  "commands.chmod": (s) => knob(s.commandChecks?.chmod),
3072
3162
  "commands.sql-ddl": (s) => knob(s.commandChecks?.sqlDdl),
3073
- "commands.unknown": (s) => s.mode === void 0 ? void 0 : s.mode === "strict" ? "review" : "off",
3163
+ "commands.unknown": (s) => s.mode === void 0 ? void 0 : isBlockAll(s.mode) ? "review" : "off",
3074
3164
  "data.secrets": (s) => enabledOr(s.dlp?.enabled, "block"),
3075
3165
  "data.secrets-weak": (s) => {
3076
3166
  if (s.dlp?.enabled === false) return "off";
@@ -3109,19 +3199,21 @@ function resolveCheck(settings, id) {
3109
3199
  if (!def) return void 0;
3110
3200
  if (isLockedCheck(def)) return { id, value: "block", source: "locked" };
3111
3201
  const floor = def.floor ? CHECK_VERDICT_RANK[def.floor] : 0;
3202
+ const levelDefault = levelCheckValue(settings.mode, id) ?? def.defaultValue;
3203
+ const sourceOf = (value2) => value2 === levelDefault ? "default" : "configured";
3112
3204
  const explicit = settings.checks?.[id];
3113
3205
  if (isVerdict(explicit)) {
3114
3206
  const value2 = CHECK_VERDICT_RANK[explicit] < floor ? def.floor : explicit;
3115
- return { id, value: value2, source: value2 === def.defaultValue ? "default" : "configured" };
3207
+ return { id, value: value2, source: sourceOf(value2) };
3116
3208
  }
3117
3209
  if (def.pack) {
3118
3210
  const on = settings.appliedShields?.includes(def.pack) ?? false;
3119
3211
  return { id, value: on ? def.defaultValue : "off", source: "default" };
3120
3212
  }
3121
3213
  const read = LEGACY_READERS[id]?.(settings);
3122
- if (read === void 0) return { id, value: def.defaultValue, source: "default" };
3214
+ if (read === void 0) return { id, value: levelDefault, source: "default" };
3123
3215
  const value = CHECK_VERDICT_RANK[read] < floor ? def.floor : read;
3124
- return { id, value, source: value === def.defaultValue ? "default" : "configured" };
3216
+ return { id, value, source: sourceOf(value) };
3125
3217
  }
3126
3218
  function resolveAllChecks(settings) {
3127
3219
  return CHECKS.map((c) => resolveCheck(settings, c.id));
@@ -12916,7 +13008,7 @@ function checksFromLegacyPolicy(policy, mode) {
12916
13008
  if (uc?.enabled === false) out["behavior.untrusted-content"] = "off";
12917
13009
  else if (uc?.enabled === true)
12918
13010
  out["behavior.untrusted-content"] = uc.afterExposure === "log-only" ? "log" : "review";
12919
- if (mode === "strict") out["commands.unknown"] = "review";
13011
+ if (isBlockAll(mode)) out["commands.unknown"] = "review";
12920
13012
  return out;
12921
13013
  }
12922
13014
  function checkToLegacyPolicy(policy, id, v) {
@@ -13008,6 +13100,25 @@ function checkToLegacyPolicy(policy, id, v) {
13008
13100
  return false;
13009
13101
  }
13010
13102
  }
13103
+ function knobStatedChecks(policy) {
13104
+ const out = /* @__PURE__ */ new Set();
13105
+ const has = (o, key) => !!o && typeof o === "object" && o[key] !== void 0;
13106
+ const { dlp, egress, loopDetection, injectionScan, skillPinning, packageCheck } = policy;
13107
+ const uc = policy.untrustedContent;
13108
+ if (has(dlp, "enabled")) out.add("data.secrets");
13109
+ if (has(dlp, "reviewAction") || dlp?.enabled === false) out.add("data.secrets-weak");
13110
+ if (has(dlp, "pii")) out.add("data.pii");
13111
+ if (has(egress, "enabled") || has(egress, "mode")) out.add("network.unknown-host");
13112
+ if (has(egress, "ssrfStrict")) out.add("network.internal-addresses");
13113
+ if (has(loopDetection, "enabled")) out.add("behavior.loops");
13114
+ if (has(injectionScan, "enabled")) out.add("behavior.prompt-injection");
13115
+ if (has(skillPinning, "enabled") || has(skillPinning, "mode")) out.add("loading.skill-tamper");
13116
+ if (has(packageCheck, "enabled") || has(packageCheck, "onMalicious"))
13117
+ out.add("loading.malicious-package");
13118
+ if (uc && typeof uc === "object" && (uc.enabled === false || has(uc, "afterExposure")))
13119
+ out.add("behavior.untrusted-content");
13120
+ return out;
13121
+ }
13011
13122
  var MAP_GOVERNED = /* @__PURE__ */ new Set([
13012
13123
  "files.shell-startup",
13013
13124
  "files.password-hashes",
@@ -14074,7 +14185,7 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
14074
14185
  if (v?.logged) noteLogged(v);
14075
14186
  else if (v) candidates.push(v);
14076
14187
  };
14077
- const inline = config.settings.mode === "strict" ? detectInlineExec(shellCommand) ? void 0 : null : inlineExecReview(shellCommand);
14188
+ const inline = reviewsEveryInline(config.settings.mode) ? detectInlineExec(shellCommand) ? void 0 : null : inlineExecReview(shellCommand);
14078
14189
  if (inline !== null) {
14079
14190
  consider("commands.inline-exec", {
14080
14191
  decision: "review",
@@ -14134,21 +14245,17 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
14134
14245
  if (firstToken && firstToken.startsWith("/") && checkProvenance) {
14135
14246
  const prov = checkProvenance(firstToken, cwd);
14136
14247
  if (prov.trustLevel === "suspect") {
14137
- const value = cv("commands.temp-binary");
14138
- const v = applyCheckValue(
14139
- value === "review" && config.settings.mode === "strict" ? "block" : value,
14140
- {
14141
- decision: "review",
14142
- blockedByLabel: "Node9: Suspect Binary",
14143
- reason: `Binary "${firstToken}" resolved to ${prov.resolvedPath} \u2014 ${prov.reason}`,
14144
- tier: 3,
14145
- checkId: "commands.temp-binary"
14146
- }
14147
- );
14248
+ const v = applyCheckValue(cv("commands.temp-binary"), {
14249
+ decision: "review",
14250
+ blockedByLabel: "Node9: Suspect Binary",
14251
+ reason: `Binary "${firstToken}" resolved to ${prov.resolvedPath} \u2014 ${prov.reason}`,
14252
+ tier: 3,
14253
+ checkId: "commands.temp-binary"
14254
+ });
14148
14255
  if (v?.logged) noteLogged(v);
14149
14256
  else if (v) return v;
14150
14257
  }
14151
- if (prov.trustLevel === "unknown" && config.settings.mode === "strict") {
14258
+ if (prov.trustLevel === "unknown" && isBlockAll(config.settings.mode)) {
14152
14259
  return {
14153
14260
  decision: "review",
14154
14261
  blockedByLabel: "Node9: Unknown Binary (strict mode)",
@@ -14239,7 +14346,7 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
14239
14346
  if (v?.logged) noteLogged(v);
14240
14347
  else if (v) return v;
14241
14348
  }
14242
- if (config.settings.mode === "strict") {
14349
+ if (isBlockAll(config.settings.mode)) {
14243
14350
  if (activeEnvironment?.requireApproval === false) return allowed();
14244
14351
  return {
14245
14352
  decision: "review",
@@ -16241,12 +16348,14 @@ var ENGINE_VERSION = "1.4.0";
16241
16348
  FS_READ_TOOLS,
16242
16349
  GENERAL_ACTION_RULES,
16243
16350
  KNOB_GOVERNED,
16351
+ LEVELS,
16244
16352
  LONG_OUTPUT_THRESHOLD_BYTES,
16245
16353
  LOOP_MAX_RECORDS,
16246
16354
  LOOP_THRESHOLD_FOR_WASTE,
16247
16355
  MAP_GOVERNED,
16248
16356
  MAX_BLAST_PATH,
16249
16357
  MAX_DESTINATIONS,
16358
+ MODE_VALUES,
16250
16359
  NET_BINARIES,
16251
16360
  PATTERN_VERB_NAMES,
16252
16361
  PRIVILEGE_ESCALATION_RE,
@@ -16331,6 +16440,7 @@ var ENGINE_VERSION = "1.4.0";
16331
16440
  inspectionLayers,
16332
16441
  isAgentInstructionPath,
16333
16442
  isBashTool,
16443
+ isBlockAll,
16334
16444
  isDestructiveToolName,
16335
16445
  isHashedEntry,
16336
16446
  isIgnoredTool,
@@ -16340,13 +16450,20 @@ var ENGINE_VERSION = "1.4.0";
16340
16450
  isLockedCheck,
16341
16451
  isLoopbackHost,
16342
16452
  isMaskedKind,
16453
+ isModeValue,
16343
16454
  isPasswordHashPath,
16344
16455
  isPrivateHost,
16345
16456
  isProtectedHomePath,
16457
+ isRecordOnly,
16346
16458
  isShellShapedTool,
16347
16459
  isShieldVerdict,
16348
16460
  isStrictGatedTier,
16349
16461
  isVerdict,
16462
+ knobStatedChecks,
16463
+ levelCheckValue,
16464
+ levelChecks,
16465
+ levelOf,
16466
+ levelPackageSignals,
16350
16467
  maskDestination,
16351
16468
  maskPersonalData,
16352
16469
  maskPersonalValue,
@@ -16377,6 +16494,7 @@ var ENGINE_VERSION = "1.4.0";
16377
16494
  resolveCheckMap,
16378
16495
  resolvePinned,
16379
16496
  resolveShellInput,
16497
+ reviewsEveryInline,
16380
16498
  ruleServerMatches,
16381
16499
  safeMessage,
16382
16500
  sampleCopyCommand,
package/dist/index.mjs CHANGED
@@ -2047,7 +2047,7 @@ var CHECK_TEXT = {
2047
2047
  "actions.money": {
2048
2048
  plain: "The agent moves money (a refund, a payout, a transfer, a charge) through an app node9 has no protection for, such as an internal billing server.",
2049
2049
  example: "refund_order on a server called acme-billing",
2050
- advice: "Keep Review. When the app is Stripe or PayPal, turn on its own protection instead: it covers the CLI, the API and scripts too, and a call from it no longer comes here."
2050
+ advice: "Standard records these and Strict asks. Set Review to be asked before every money move at any level. When the app is Stripe or PayPal, turn on its own protection instead: it covers the CLI, the API and scripts too, and a call from it no longer comes here."
2051
2051
  },
2052
2052
  "actions.access": {
2053
2053
  plain: "The agent changes a password, a key, a role or who belongs to a team, through an app node9 has no protection for.",
@@ -2225,6 +2225,82 @@ var CHECK_TEXT = {
2225
2225
  }
2226
2226
  };
2227
2227
 
2228
+ // src/levels.ts
2229
+ var LEVELS = ["audit", "soft", "standard", "strict", "block-all"];
2230
+ var MODE_VALUES = ["observe", ...LEVELS];
2231
+ function isModeValue(v) {
2232
+ return typeof v === "string" && MODE_VALUES.includes(v);
2233
+ }
2234
+ function levelOf(mode) {
2235
+ if (mode === "observe") return "audit";
2236
+ return LEVELS.includes(mode ?? "") ? mode : "standard";
2237
+ }
2238
+ function isRecordOnly(mode) {
2239
+ return levelOf(mode) === "audit";
2240
+ }
2241
+ function reviewsEveryInline(mode) {
2242
+ const level = levelOf(mode);
2243
+ return level === "strict" || level === "block-all";
2244
+ }
2245
+ function isBlockAll(mode) {
2246
+ return levelOf(mode) === "block-all";
2247
+ }
2248
+ var SOFT = {
2249
+ "commands.inline-exec": "log",
2250
+ "commands.eval-dynamic": "log",
2251
+ "commands.rm": "log",
2252
+ "commands.chmod": "log",
2253
+ "commands.sudo": "log",
2254
+ "commands.git-destructive": "log",
2255
+ "commands.sql-ddl": "log",
2256
+ "commands.sql-no-where": "log",
2257
+ "commands.temp-binary": "log",
2258
+ "commands.disk-destroy": "log",
2259
+ "commands.dangerous-word": "log",
2260
+ "files.system-dirs": "log",
2261
+ "files.shell-startup": "log",
2262
+ "files.password-hashes": "log",
2263
+ "data.pipe-chain": "log",
2264
+ "behavior.untrusted-content": "log"
2265
+ };
2266
+ var STRICT = {
2267
+ "commands.sql-ddl": "block",
2268
+ "commands.disk-destroy": "block",
2269
+ "commands.node9-disarm": "block",
2270
+ "files.system-dirs": "block",
2271
+ "files.shell-startup": "block",
2272
+ "files.password-hashes": "block",
2273
+ "data.secrets-weak": "block",
2274
+ "data.pipe-chain": "block",
2275
+ "network.unknown-host": "review",
2276
+ "network.internal-addresses": "block",
2277
+ "behavior.prompt-injection": "log",
2278
+ "loading.skill-tamper": "block",
2279
+ // Standard records money moves (catalog default log); Strict asks.
2280
+ "actions.money": "review"
2281
+ };
2282
+ var BLOCK_ALL = {
2283
+ ...STRICT,
2284
+ "commands.unknown": "review",
2285
+ "commands.temp-binary": "block"
2286
+ };
2287
+ var LEVEL_CHECKS = {
2288
+ audit: {},
2289
+ soft: SOFT,
2290
+ standard: {},
2291
+ strict: STRICT,
2292
+ "block-all": BLOCK_ALL
2293
+ };
2294
+ function levelCheckValue(mode, id) {
2295
+ return LEVEL_CHECKS[levelOf(mode)][id];
2296
+ }
2297
+ function levelChecks(mode) {
2298
+ return LEVEL_CHECKS[levelOf(mode)];
2299
+ }
2300
+ function levelPackageSignals(mode) {
2301
+ return levelOf(mode) === "soft" ? { newPackage: "off", installScript: "off" } : void 0;
2302
+ }
2303
+
2228
2304
  // src/catalog.ts
2229
2305
  var VERDICTS = ["off", "log", "review", "block"];
2230
2306
  var CHECK_VERDICT_RANK = { off: 0, log: 1, review: 2, block: 3 };
@@ -2654,7 +2730,10 @@ var PRODUCT_CHECKS = [
2654
2730
  title: "Money moves",
2655
2731
  catches: "a refund, payout, transfer, charge or withdrawal through an app with no protection of its own",
2656
2732
  values: ALL,
2657
- defaultValue: "review",
2733
+ // Founder decision 2026-10-25: a transfer the user asked for is ordinary
2734
+ // work. Standard records it; Strict asks (levels.ts); a user who wants to
2735
+ // be asked states review.
2736
+ defaultValue: "log",
2658
2737
  legacy: generalActionRuleNames("finance")
2659
2738
  },
2660
2739
  {
@@ -2831,7 +2910,7 @@ var LEGACY_READERS = {
2831
2910
  "commands.rm": (s) => knob(s.commandChecks?.rmAdvisory),
2832
2911
  "commands.chmod": (s) => knob(s.commandChecks?.chmod),
2833
2912
  "commands.sql-ddl": (s) => knob(s.commandChecks?.sqlDdl),
2834
- "commands.unknown": (s) => s.mode === void 0 ? void 0 : s.mode === "strict" ? "review" : "off",
2913
+ "commands.unknown": (s) => s.mode === void 0 ? void 0 : isBlockAll(s.mode) ? "review" : "off",
2835
2914
  "data.secrets": (s) => enabledOr(s.dlp?.enabled, "block"),
2836
2915
  "data.secrets-weak": (s) => {
2837
2916
  if (s.dlp?.enabled === false) return "off";
@@ -2870,19 +2949,21 @@ function resolveCheck(settings, id) {
2870
2949
  if (!def) return void 0;
2871
2950
  if (isLockedCheck(def)) return { id, value: "block", source: "locked" };
2872
2951
  const floor = def.floor ? CHECK_VERDICT_RANK[def.floor] : 0;
2952
+ const levelDefault = levelCheckValue(settings.mode, id) ?? def.defaultValue;
2953
+ const sourceOf = (value2) => value2 === levelDefault ? "default" : "configured";
2873
2954
  const explicit = settings.checks?.[id];
2874
2955
  if (isVerdict(explicit)) {
2875
2956
  const value2 = CHECK_VERDICT_RANK[explicit] < floor ? def.floor : explicit;
2876
- return { id, value: value2, source: value2 === def.defaultValue ? "default" : "configured" };
2957
+ return { id, value: value2, source: sourceOf(value2) };
2877
2958
  }
2878
2959
  if (def.pack) {
2879
2960
  const on = settings.appliedShields?.includes(def.pack) ?? false;
2880
2961
  return { id, value: on ? def.defaultValue : "off", source: "default" };
2881
2962
  }
2882
2963
  const read = LEGACY_READERS[id]?.(settings);
2883
- if (read === void 0) return { id, value: def.defaultValue, source: "default" };
2964
+ if (read === void 0) return { id, value: levelDefault, source: "default" };
2884
2965
  const value = CHECK_VERDICT_RANK[read] < floor ? def.floor : read;
2885
- return { id, value, source: value === def.defaultValue ? "default" : "configured" };
2966
+ return { id, value, source: sourceOf(value) };
2886
2967
  }
2887
2968
  function resolveAllChecks(settings) {
2888
2969
  return CHECKS.map((c) => resolveCheck(settings, c.id));
@@ -12677,7 +12758,7 @@ function checksFromLegacyPolicy(policy, mode) {
12677
12758
  if (uc?.enabled === false) out["behavior.untrusted-content"] = "off";
12678
12759
  else if (uc?.enabled === true)
12679
12760
  out["behavior.untrusted-content"] = uc.afterExposure === "log-only" ? "log" : "review";
12680
- if (mode === "strict") out["commands.unknown"] = "review";
12761
+ if (isBlockAll(mode)) out["commands.unknown"] = "review";
12681
12762
  return out;
12682
12763
  }
12683
12764
  function checkToLegacyPolicy(policy, id, v) {
@@ -12769,6 +12850,25 @@ function checkToLegacyPolicy(policy, id, v) {
12769
12850
  return false;
12770
12851
  }
12771
12852
  }
12853
+ function knobStatedChecks(policy) {
12854
+ const out = /* @__PURE__ */ new Set();
12855
+ const has = (o, key) => !!o && typeof o === "object" && o[key] !== void 0;
12856
+ const { dlp, egress, loopDetection, injectionScan, skillPinning, packageCheck } = policy;
12857
+ const uc = policy.untrustedContent;
12858
+ if (has(dlp, "enabled")) out.add("data.secrets");
12859
+ if (has(dlp, "reviewAction") || dlp?.enabled === false) out.add("data.secrets-weak");
12860
+ if (has(dlp, "pii")) out.add("data.pii");
12861
+ if (has(egress, "enabled") || has(egress, "mode")) out.add("network.unknown-host");
12862
+ if (has(egress, "ssrfStrict")) out.add("network.internal-addresses");
12863
+ if (has(loopDetection, "enabled")) out.add("behavior.loops");
12864
+ if (has(injectionScan, "enabled")) out.add("behavior.prompt-injection");
12865
+ if (has(skillPinning, "enabled") || has(skillPinning, "mode")) out.add("loading.skill-tamper");
12866
+ if (has(packageCheck, "enabled") || has(packageCheck, "onMalicious"))
12867
+ out.add("loading.malicious-package");
12868
+ if (uc && typeof uc === "object" && (uc.enabled === false || has(uc, "afterExposure")))
12869
+ out.add("behavior.untrusted-content");
12870
+ return out;
12871
+ }
12772
12872
  var MAP_GOVERNED = /* @__PURE__ */ new Set([
12773
12873
  "files.shell-startup",
12774
12874
  "files.password-hashes",
@@ -13835,7 +13935,7 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
13835
13935
  if (v?.logged) noteLogged(v);
13836
13936
  else if (v) candidates.push(v);
13837
13937
  };
13838
- const inline = config.settings.mode === "strict" ? detectInlineExec(shellCommand) ? void 0 : null : inlineExecReview(shellCommand);
13938
+ const inline = reviewsEveryInline(config.settings.mode) ? detectInlineExec(shellCommand) ? void 0 : null : inlineExecReview(shellCommand);
13839
13939
  if (inline !== null) {
13840
13940
  consider("commands.inline-exec", {
13841
13941
  decision: "review",
@@ -13895,21 +13995,17 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
13895
13995
  if (firstToken && firstToken.startsWith("/") && checkProvenance) {
13896
13996
  const prov = checkProvenance(firstToken, cwd);
13897
13997
  if (prov.trustLevel === "suspect") {
13898
- const value = cv("commands.temp-binary");
13899
- const v = applyCheckValue(
13900
- value === "review" && config.settings.mode === "strict" ? "block" : value,
13901
- {
13902
- decision: "review",
13903
- blockedByLabel: "Node9: Suspect Binary",
13904
- reason: `Binary "${firstToken}" resolved to ${prov.resolvedPath} \u2014 ${prov.reason}`,
13905
- tier: 3,
13906
- checkId: "commands.temp-binary"
13907
- }
13908
- );
13998
+ const v = applyCheckValue(cv("commands.temp-binary"), {
13999
+ decision: "review",
14000
+ blockedByLabel: "Node9: Suspect Binary",
14001
+ reason: `Binary "${firstToken}" resolved to ${prov.resolvedPath} \u2014 ${prov.reason}`,
14002
+ tier: 3,
14003
+ checkId: "commands.temp-binary"
14004
+ });
13909
14005
  if (v?.logged) noteLogged(v);
13910
14006
  else if (v) return v;
13911
14007
  }
13912
- if (prov.trustLevel === "unknown" && config.settings.mode === "strict") {
14008
+ if (prov.trustLevel === "unknown" && isBlockAll(config.settings.mode)) {
13913
14009
  return {
13914
14010
  decision: "review",
13915
14011
  blockedByLabel: "Node9: Unknown Binary (strict mode)",
@@ -14000,7 +14096,7 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
14000
14096
  if (v?.logged) noteLogged(v);
14001
14097
  else if (v) return v;
14002
14098
  }
14003
- if (config.settings.mode === "strict") {
14099
+ if (isBlockAll(config.settings.mode)) {
14004
14100
  if (activeEnvironment?.requireApproval === false) return allowed();
14005
14101
  return {
14006
14102
  decision: "review",
@@ -16001,12 +16097,14 @@ export {
16001
16097
  FS_READ_TOOLS,
16002
16098
  GENERAL_ACTION_RULES,
16003
16099
  KNOB_GOVERNED,
16100
+ LEVELS,
16004
16101
  LONG_OUTPUT_THRESHOLD_BYTES,
16005
16102
  LOOP_MAX_RECORDS,
16006
16103
  LOOP_THRESHOLD_FOR_WASTE,
16007
16104
  MAP_GOVERNED,
16008
16105
  MAX_BLAST_PATH,
16009
16106
  MAX_DESTINATIONS,
16107
+ MODE_VALUES,
16010
16108
  NET_BINARIES,
16011
16109
  PATTERN_VERB_NAMES,
16012
16110
  PRIVILEGE_ESCALATION_RE,
@@ -16091,6 +16189,7 @@ export {
16091
16189
  inspectionLayers,
16092
16190
  isAgentInstructionPath,
16093
16191
  isBashTool,
16192
+ isBlockAll,
16094
16193
  isDestructiveToolName,
16095
16194
  isHashedEntry,
16096
16195
  isIgnoredTool,
@@ -16100,13 +16199,20 @@ export {
16100
16199
  isLockedCheck,
16101
16200
  isLoopbackHost,
16102
16201
  isMaskedKind,
16202
+ isModeValue,
16103
16203
  isPasswordHashPath,
16104
16204
  isPrivateHost,
16105
16205
  isProtectedHomePath,
16206
+ isRecordOnly,
16106
16207
  isShellShapedTool,
16107
16208
  isShieldVerdict,
16108
16209
  isStrictGatedTier,
16109
16210
  isVerdict,
16211
+ knobStatedChecks,
16212
+ levelCheckValue,
16213
+ levelChecks,
16214
+ levelOf,
16215
+ levelPackageSignals,
16110
16216
  maskDestination,
16111
16217
  maskPersonalData,
16112
16218
  maskPersonalValue,
@@ -16137,6 +16243,7 @@ export {
16137
16243
  resolveCheckMap,
16138
16244
  resolvePinned,
16139
16245
  resolveShellInput,
16246
+ reviewsEveryInline,
16140
16247
  ruleServerMatches,
16141
16248
  safeMessage,
16142
16249
  sampleCopyCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/policy-engine",
3
- "version": "2.38.0",
3
+ "version": "2.40.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",