@node9/policy-engine 2.31.3 → 2.32.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
@@ -103,6 +103,9 @@ interface RiskMetadata {
103
103
  ruleName?: string;
104
104
  /** Human-readable description of the matched smart rule or shield. */
105
105
  ruleDescription?: string;
106
+ /** fw#318: the destinations an exposure review holds ('email:x@y', 'host:h'),
107
+ * for the "Approve and trust this address" button. Local surfaces only. */
108
+ exposureDestinations?: string[];
106
109
  }
107
110
 
108
111
  type ToolInspectionEntry = string | {
@@ -305,6 +308,10 @@ interface CatalogSettings {
305
308
  enabled?: boolean;
306
309
  onMalicious?: string;
307
310
  };
311
+ untrustedContent?: {
312
+ enabled?: boolean;
313
+ afterExposure?: string;
314
+ };
308
315
  /** Shields the host actually injected (`policy.appliedShields`). */
309
316
  appliedShields?: readonly string[];
310
317
  /**
@@ -356,6 +363,18 @@ declare function resolveCheckMap(settings: CatalogSettings): Record<string, Verd
356
363
  declare const SYSTEM_AUTH_FILES: readonly ["/etc/passwd", "/etc/shadow", "/etc/group", "/etc/gshadow", "/etc/sudoers"];
357
364
  declare const SYSTEM_AUTH_DIRS: readonly ["/etc/security", "/etc/pam.d", "/etc/sudoers.d"];
358
365
  declare const STARTUP_NAMES: readonly [".bashrc", ".zshrc", ".profile", ".bash_profile"];
366
+ /**
367
+ * Files inside a project that run code or instruct the agent (fw#318 P4,
368
+ * design 6). A write there after the session read outside content is held:
369
+ * it is how an injected instruction persists past the session. Relative to
370
+ * the project root; a directory entry covers everything under it.
371
+ */
372
+ declare const AGENT_INSTRUCTION_FILES: readonly [".gitlab-ci.yml", "CLAUDE.md", "AGENTS.md", ".cursorrules", ".mcp.json", ".vscode/settings.json", "package.json"];
373
+ declare const AGENT_INSTRUCTION_DIRS: readonly [".github/workflows", ".claude", ".cursor", ".git/hooks", ".husky"];
374
+ /** Is `absPath` one of the agent-instruction files of the project at `root`? */
375
+ declare function isAgentInstructionPath(absPath: string, root: string): boolean;
376
+ /** `isInside(root, p)`: `p` is `root` or below it, lexically. */
377
+ declare function isInside(root: string, p: string): boolean;
359
378
  declare function isPasswordHashPath(p: string): boolean;
360
379
  /** Compatibility only: old callers do not tell DLP whether they read or write. */
361
380
  declare function isLegacySystemPath(p: string): boolean;
@@ -1033,6 +1052,12 @@ interface LegacyPolicyKnobs {
1033
1052
  onlineFallback?: boolean;
1034
1053
  allow?: string[];
1035
1054
  };
1055
+ untrustedContent?: {
1056
+ enabled?: boolean;
1057
+ spotlight?: boolean;
1058
+ afterExposure?: string;
1059
+ orgDomains?: string[];
1060
+ };
1036
1061
  }
1037
1062
  interface TuningField {
1038
1063
  checkId: string;
@@ -1127,6 +1152,68 @@ declare function extractPositionalArgs(tokens: string[], binary: string): string
1127
1152
  */
1128
1153
  declare function extractNetworkTargets(tokens: string[], binary: string): string[];
1129
1154
 
1155
+ type DestinationKind = 'email' | 'host' | 'iban' | 'account';
1156
+ /** Upper bound on values kept from one text or one call. */
1157
+ declare const MAX_DESTINATIONS = 200;
1158
+ /**
1159
+ * Every destination-like value in a text a tool returned (or a prompt the
1160
+ * user typed). Emails anywhere; hosts only from URLs with a scheme or a
1161
+ * `www.` prefix; IBANs only when the checksum holds.
1162
+ */
1163
+ declare function extractContentDestinations(text: string): string[];
1164
+ /**
1165
+ * Every destination-like value in a tool call's arguments. Like the content
1166
+ * extractor, plus: a string under a recipient key (`to`, `recipient`, ...)
1167
+ * counts as a host when it is a bare hostname, so `send_money {recipient:
1168
+ * "US12..."}` and `send_email {to: "x@y.z"}` both yield their destination.
1169
+ */
1170
+ declare function extractArgDestinations(args: unknown): string[];
1171
+ /** `email:a@b.c` -> `b.c`; other kinds have no domain. */
1172
+ declare function destinationDomain(dest: string): string | null;
1173
+ /** The kind prefix of a normalised destination. */
1174
+ declare function destinationKind(dest: string): DestinationKind | null;
1175
+ /** The value a person reads, without the kind prefix. */
1176
+ declare function destinationValue(dest: string): string;
1177
+ /** A loopback host: the machine itself (`localhost`, `*.localhost`,
1178
+ * 127.0.0.0/8, `::1`, `0.0.0.0`). A send there never leaves the machine. */
1179
+ declare function isLoopbackHost(host: string): boolean;
1180
+ /**
1181
+ * The repository a git url names, as `host/owner/name` lower-cased with
1182
+ * `.git` and slashes trimmed: https, ssh://, scp-like `git@host:owner/name`.
1183
+ * Null for a local path or a url without a path.
1184
+ */
1185
+ declare function gitRepoPath(url: string): string | null;
1186
+ declare function isDestructiveToolName(bareTool: string): boolean;
1187
+
1188
+ interface ShellExposure {
1189
+ /** The command brings outside content in: its output is a source. */
1190
+ fetches: boolean;
1191
+ /** The command carries something out: the call is an action. */
1192
+ sends: boolean;
1193
+ /** Normalised destinations of the sending calls ('host:x.example'). */
1194
+ destinations: string[];
1195
+ /** `git push <remote-name>`: the remote names used, for the host to resolve;
1196
+ * '' is a push with no target (the branch's default remote). */
1197
+ gitRemotes: string[];
1198
+ /**
1199
+ * Repositories the git-host sends reach, `host/owner/name`. A host is not
1200
+ * enough there: github.com holds the project's origin and every attacker's
1201
+ * mirror. `host/*` is a repository the command does not name (a gist, a new
1202
+ * repository, a GraphQL call). A send to the current repository (`gh issue
1203
+ * comment 7`) names none.
1204
+ */
1205
+ repos: string[];
1206
+ /** A send whose target this command makes unknowable (`cd x && git push`,
1207
+ * `git -C x push`, a dynamic `-R`): held after exposure. */
1208
+ unresolved: boolean;
1209
+ /** Hosts the fetching calls reach ('host:x.example'), literal prefixes of dynamic URLs included. */
1210
+ fetchDestinations: string[];
1211
+ /** Short labels of the fetching calls ('curl', 'gh issue', 'git pull'), for the frame. */
1212
+ fetchKinds: string[];
1213
+ }
1214
+ /** Classify a shell command as a source, a sink, both or neither. Never throws. */
1215
+ declare function classifyShellExposure(command: string): ShellExposure;
1216
+
1130
1217
  /**
1131
1218
  * Glob match a tool name against one pattern or a list, with case-insensitive
1132
1219
  * matching and a leading-`./` tolerance: `./bin/foo` matches `bin/foo` and
@@ -1848,7 +1935,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v25";
1848
1935
  * files changed, this hash must change too, and you must consciously
1849
1936
  * decide whether to bump CANONICAL_EXTRACTOR_VERSION."
1850
1937
  */
1851
- declare const CANONICAL_EXTRACTOR_HASH = "d734bd7389fbaf7e";
1938
+ declare const CANONICAL_EXTRACTOR_HASH = "48ef4af5dd89198d";
1852
1939
  declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
1853
1940
  declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
1854
1941
  /**
@@ -1957,4 +2044,4 @@ declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
1957
2044
  /** Engine version stamped on audit entries for future drift detection. */
1958
2045
  declare const ENGINE_VERSION = "1.4.0";
1959
2046
 
1960
- export { ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, type ArgumentInspectionResult, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, 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, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, type CatalogSettings, type CheckDef, type CheckGroup, type CheckSource, type CheckText, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type Destination, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FileAccess, type FileAccessContext, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, KNOB_GOVERNED, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LegacyPolicyKnobs, type LoopWindowEvaluation, MAP_GOVERNED, MAX_BLAST_PATH, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, type PackageEcosystem, type PackageInstallRequest, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type PositionedArg, type ProtectedFileVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type ResolvedCheck, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, type ScanFinding, type ScanSignals, type ScanSummary, type ScanView, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShellInputResolution, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, TUNING_FIELDS, type ToolCallEntry, type ToolCallRecord, type ToolInspection, type ToolInspectionEntry, type TuningField, VERDICTS, type Verdict, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, catalogSettingsFromConfig, checkDangerousSql, checkIdForCheckedBy, checkIdForRule, checkToLegacyPolicy, checkValue, checksFromLegacyPolicy, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifySsrf, collectFileAccesses, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, configurableValues, decodeEmbeddedBase64, decodeEmbeddedHex, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, hostMatches, incompleteFileVerdict, inspectArgumentSecrets, isBashTool, isIgnoredTool, isKnobGoverned, isLegacySystemPath, isLockedCheck, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
2047
+ export { AGENT_INSTRUCTION_DIRS, AGENT_INSTRUCTION_FILES, ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, type ArgumentInspectionResult, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, 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, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, type CatalogSettings, type CheckDef, type CheckGroup, type CheckSource, type CheckText, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type Destination, type DestinationKind, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FileAccess, type FileAccessContext, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, KNOB_GOVERNED, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LegacyPolicyKnobs, type LoopWindowEvaluation, MAP_GOVERNED, MAX_BLAST_PATH, MAX_DESTINATIONS, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, type PackageEcosystem, type PackageInstallRequest, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type PositionedArg, type ProtectedFileVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type ResolvedCheck, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, type ScanFinding, type ScanSignals, type ScanSummary, type ScanView, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShellExposure, type ShellInputResolution, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, TUNING_FIELDS, type ToolCallEntry, type ToolCallRecord, type ToolInspection, type ToolInspectionEntry, type TuningField, VERDICTS, type Verdict, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, 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, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hostMatches, incompleteFileVerdict, inspectArgumentSecrets, isAgentInstructionPath, isBashTool, isDestructiveToolName, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
package/dist/index.d.ts CHANGED
@@ -103,6 +103,9 @@ interface RiskMetadata {
103
103
  ruleName?: string;
104
104
  /** Human-readable description of the matched smart rule or shield. */
105
105
  ruleDescription?: string;
106
+ /** fw#318: the destinations an exposure review holds ('email:x@y', 'host:h'),
107
+ * for the "Approve and trust this address" button. Local surfaces only. */
108
+ exposureDestinations?: string[];
106
109
  }
107
110
 
108
111
  type ToolInspectionEntry = string | {
@@ -305,6 +308,10 @@ interface CatalogSettings {
305
308
  enabled?: boolean;
306
309
  onMalicious?: string;
307
310
  };
311
+ untrustedContent?: {
312
+ enabled?: boolean;
313
+ afterExposure?: string;
314
+ };
308
315
  /** Shields the host actually injected (`policy.appliedShields`). */
309
316
  appliedShields?: readonly string[];
310
317
  /**
@@ -356,6 +363,18 @@ declare function resolveCheckMap(settings: CatalogSettings): Record<string, Verd
356
363
  declare const SYSTEM_AUTH_FILES: readonly ["/etc/passwd", "/etc/shadow", "/etc/group", "/etc/gshadow", "/etc/sudoers"];
357
364
  declare const SYSTEM_AUTH_DIRS: readonly ["/etc/security", "/etc/pam.d", "/etc/sudoers.d"];
358
365
  declare const STARTUP_NAMES: readonly [".bashrc", ".zshrc", ".profile", ".bash_profile"];
366
+ /**
367
+ * Files inside a project that run code or instruct the agent (fw#318 P4,
368
+ * design 6). A write there after the session read outside content is held:
369
+ * it is how an injected instruction persists past the session. Relative to
370
+ * the project root; a directory entry covers everything under it.
371
+ */
372
+ declare const AGENT_INSTRUCTION_FILES: readonly [".gitlab-ci.yml", "CLAUDE.md", "AGENTS.md", ".cursorrules", ".mcp.json", ".vscode/settings.json", "package.json"];
373
+ declare const AGENT_INSTRUCTION_DIRS: readonly [".github/workflows", ".claude", ".cursor", ".git/hooks", ".husky"];
374
+ /** Is `absPath` one of the agent-instruction files of the project at `root`? */
375
+ declare function isAgentInstructionPath(absPath: string, root: string): boolean;
376
+ /** `isInside(root, p)`: `p` is `root` or below it, lexically. */
377
+ declare function isInside(root: string, p: string): boolean;
359
378
  declare function isPasswordHashPath(p: string): boolean;
360
379
  /** Compatibility only: old callers do not tell DLP whether they read or write. */
361
380
  declare function isLegacySystemPath(p: string): boolean;
@@ -1033,6 +1052,12 @@ interface LegacyPolicyKnobs {
1033
1052
  onlineFallback?: boolean;
1034
1053
  allow?: string[];
1035
1054
  };
1055
+ untrustedContent?: {
1056
+ enabled?: boolean;
1057
+ spotlight?: boolean;
1058
+ afterExposure?: string;
1059
+ orgDomains?: string[];
1060
+ };
1036
1061
  }
1037
1062
  interface TuningField {
1038
1063
  checkId: string;
@@ -1127,6 +1152,68 @@ declare function extractPositionalArgs(tokens: string[], binary: string): string
1127
1152
  */
1128
1153
  declare function extractNetworkTargets(tokens: string[], binary: string): string[];
1129
1154
 
1155
+ type DestinationKind = 'email' | 'host' | 'iban' | 'account';
1156
+ /** Upper bound on values kept from one text or one call. */
1157
+ declare const MAX_DESTINATIONS = 200;
1158
+ /**
1159
+ * Every destination-like value in a text a tool returned (or a prompt the
1160
+ * user typed). Emails anywhere; hosts only from URLs with a scheme or a
1161
+ * `www.` prefix; IBANs only when the checksum holds.
1162
+ */
1163
+ declare function extractContentDestinations(text: string): string[];
1164
+ /**
1165
+ * Every destination-like value in a tool call's arguments. Like the content
1166
+ * extractor, plus: a string under a recipient key (`to`, `recipient`, ...)
1167
+ * counts as a host when it is a bare hostname, so `send_money {recipient:
1168
+ * "US12..."}` and `send_email {to: "x@y.z"}` both yield their destination.
1169
+ */
1170
+ declare function extractArgDestinations(args: unknown): string[];
1171
+ /** `email:a@b.c` -> `b.c`; other kinds have no domain. */
1172
+ declare function destinationDomain(dest: string): string | null;
1173
+ /** The kind prefix of a normalised destination. */
1174
+ declare function destinationKind(dest: string): DestinationKind | null;
1175
+ /** The value a person reads, without the kind prefix. */
1176
+ declare function destinationValue(dest: string): string;
1177
+ /** A loopback host: the machine itself (`localhost`, `*.localhost`,
1178
+ * 127.0.0.0/8, `::1`, `0.0.0.0`). A send there never leaves the machine. */
1179
+ declare function isLoopbackHost(host: string): boolean;
1180
+ /**
1181
+ * The repository a git url names, as `host/owner/name` lower-cased with
1182
+ * `.git` and slashes trimmed: https, ssh://, scp-like `git@host:owner/name`.
1183
+ * Null for a local path or a url without a path.
1184
+ */
1185
+ declare function gitRepoPath(url: string): string | null;
1186
+ declare function isDestructiveToolName(bareTool: string): boolean;
1187
+
1188
+ interface ShellExposure {
1189
+ /** The command brings outside content in: its output is a source. */
1190
+ fetches: boolean;
1191
+ /** The command carries something out: the call is an action. */
1192
+ sends: boolean;
1193
+ /** Normalised destinations of the sending calls ('host:x.example'). */
1194
+ destinations: string[];
1195
+ /** `git push <remote-name>`: the remote names used, for the host to resolve;
1196
+ * '' is a push with no target (the branch's default remote). */
1197
+ gitRemotes: string[];
1198
+ /**
1199
+ * Repositories the git-host sends reach, `host/owner/name`. A host is not
1200
+ * enough there: github.com holds the project's origin and every attacker's
1201
+ * mirror. `host/*` is a repository the command does not name (a gist, a new
1202
+ * repository, a GraphQL call). A send to the current repository (`gh issue
1203
+ * comment 7`) names none.
1204
+ */
1205
+ repos: string[];
1206
+ /** A send whose target this command makes unknowable (`cd x && git push`,
1207
+ * `git -C x push`, a dynamic `-R`): held after exposure. */
1208
+ unresolved: boolean;
1209
+ /** Hosts the fetching calls reach ('host:x.example'), literal prefixes of dynamic URLs included. */
1210
+ fetchDestinations: string[];
1211
+ /** Short labels of the fetching calls ('curl', 'gh issue', 'git pull'), for the frame. */
1212
+ fetchKinds: string[];
1213
+ }
1214
+ /** Classify a shell command as a source, a sink, both or neither. Never throws. */
1215
+ declare function classifyShellExposure(command: string): ShellExposure;
1216
+
1130
1217
  /**
1131
1218
  * Glob match a tool name against one pattern or a list, with case-insensitive
1132
1219
  * matching and a leading-`./` tolerance: `./bin/foo` matches `bin/foo` and
@@ -1848,7 +1935,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v25";
1848
1935
  * files changed, this hash must change too, and you must consciously
1849
1936
  * decide whether to bump CANONICAL_EXTRACTOR_VERSION."
1850
1937
  */
1851
- declare const CANONICAL_EXTRACTOR_HASH = "d734bd7389fbaf7e";
1938
+ declare const CANONICAL_EXTRACTOR_HASH = "48ef4af5dd89198d";
1852
1939
  declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
1853
1940
  declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
1854
1941
  /**
@@ -1957,4 +2044,4 @@ declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
1957
2044
  /** Engine version stamped on audit entries for future drift detection. */
1958
2045
  declare const ENGINE_VERSION = "1.4.0";
1959
2046
 
1960
- export { ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, type ArgumentInspectionResult, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, 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, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, type CatalogSettings, type CheckDef, type CheckGroup, type CheckSource, type CheckText, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type Destination, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FileAccess, type FileAccessContext, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, KNOB_GOVERNED, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LegacyPolicyKnobs, type LoopWindowEvaluation, MAP_GOVERNED, MAX_BLAST_PATH, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, type PackageEcosystem, type PackageInstallRequest, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type PositionedArg, type ProtectedFileVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type ResolvedCheck, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, type ScanFinding, type ScanSignals, type ScanSummary, type ScanView, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShellInputResolution, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, TUNING_FIELDS, type ToolCallEntry, type ToolCallRecord, type ToolInspection, type ToolInspectionEntry, type TuningField, VERDICTS, type Verdict, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, catalogSettingsFromConfig, checkDangerousSql, checkIdForCheckedBy, checkIdForRule, checkToLegacyPolicy, checkValue, checksFromLegacyPolicy, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifySsrf, collectFileAccesses, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, configurableValues, decodeEmbeddedBase64, decodeEmbeddedHex, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, hostMatches, incompleteFileVerdict, inspectArgumentSecrets, isBashTool, isIgnoredTool, isKnobGoverned, isLegacySystemPath, isLockedCheck, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
2047
+ export { AGENT_INSTRUCTION_DIRS, AGENT_INSTRUCTION_FILES, ARGUMENT_SCAN_LIMITS, AST_FS_REGEX_RULES, type ArgumentInspectionResult, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_DANGEROUS_WORDS, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, 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, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, type CatalogSettings, type CheckDef, type CheckGroup, type CheckSource, type CheckText, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type Destination, type DestinationKind, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FileAccess, type FileAccessContext, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, KNOB_GOVERNED, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LegacyPolicyKnobs, type LoopWindowEvaluation, MAP_GOVERNED, MAX_BLAST_PATH, MAX_DESTINATIONS, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, type PackageEcosystem, type PackageInstallRequest, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type PositionedArg, type ProtectedFileVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type ResolvedCheck, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, STARTUP_NAMES, SYSTEM_AUTH_DIRS, SYSTEM_AUTH_FILES, type ScanFinding, type ScanSignals, type ScanSummary, type ScanView, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShellExposure, type ShellInputResolution, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, TUNING_FIELDS, type ToolCallEntry, type ToolCallRecord, type ToolInspection, type ToolInspectionEntry, type TuningField, VERDICTS, type Verdict, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, 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, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hostMatches, incompleteFileVerdict, inspectArgumentSecrets, isAgentInstructionPath, isBashTool, isDestructiveToolName, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolveAllChecks, resolveCheck, resolveCheckMap, resolvePinned, resolveShellInput, safeMessage, sampleCopyCommand, scanArgs, scanArgumentSecrets, scanInjection, scanText, scanViews, sensitivePathMatch, shellRuleArgs, ssrfCheckId, ssrfDestinationFloor, ssrfExemptMatches, ssrfFloor, ssrfReason, stripControlChars, stripInvisible, stripTerminalEscapes, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };