@node9/policy-engine 2.31.3 → 2.33.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 +131 -18
- package/dist/index.d.ts +131 -18
- package/dist/index.js +1139 -139
- package/dist/index.mjs +1123 -139
- package/package.json +1 -1
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 | {
|
|
@@ -110,6 +113,19 @@ type ToolInspectionEntry = string | {
|
|
|
110
113
|
field: string;
|
|
111
114
|
};
|
|
112
115
|
type ToolInspection = Record<string, ToolInspectionEntry>;
|
|
116
|
+
/**
|
|
117
|
+
* Inspection mappings by provenance. `trusted` is the shipped defaults plus the
|
|
118
|
+
* user's own and the workspace's entries, with full authority. `project` is a
|
|
119
|
+
* repository-carried config file, which an agent can write in-session: it may
|
|
120
|
+
* add a shell tool or a shell field, never turn a recognized executor into a
|
|
121
|
+
* non-shell tool or point its inspection at a decoy field (fw#338, review 3).
|
|
122
|
+
*/
|
|
123
|
+
interface InspectionLayers {
|
|
124
|
+
trusted: ToolInspection;
|
|
125
|
+
project?: ToolInspection;
|
|
126
|
+
}
|
|
127
|
+
/** A plain map is read as trusted with no project layer. */
|
|
128
|
+
type InspectionInput = ToolInspection | InspectionLayers;
|
|
113
129
|
type ShellInputResolution = {
|
|
114
130
|
kind: 'not-shell';
|
|
115
131
|
} | {
|
|
@@ -122,10 +138,17 @@ type ShellInputResolution = {
|
|
|
122
138
|
};
|
|
123
139
|
declare const BASH_TOOL_NAMES: Set<string>;
|
|
124
140
|
declare function isBashTool(tool: string): boolean;
|
|
125
|
-
|
|
126
|
-
declare function
|
|
141
|
+
/** The merged policy's maps as layers; the host keeps the project layer apart. */
|
|
142
|
+
declare function inspectionLayers(policy: {
|
|
143
|
+
toolInspection: ToolInspection;
|
|
144
|
+
projectToolInspection?: ToolInspection;
|
|
145
|
+
}): InspectionLayers;
|
|
146
|
+
/** The first matching entry, trusted layer first. For legacy (SQL, explain) lookups. */
|
|
147
|
+
declare function inspectionEntry(tool: string, inspection?: InspectionInput): ToolInspectionEntry | undefined;
|
|
148
|
+
declare function isShellShapedTool(tool: string, inspection?: InspectionInput): boolean;
|
|
149
|
+
declare function resolveShellInput(tool: string, args: unknown, inspection?: InspectionInput): ShellInputResolution;
|
|
127
150
|
/** Only Bash-scoped rules receive the canonical projection. Caller data is never mutated. */
|
|
128
|
-
declare function shellRuleArgs(tool: string, args: unknown, ruleTool: string | string[] | undefined, inspection?:
|
|
151
|
+
declare function shellRuleArgs(tool: string, args: unknown, ruleTool: string | string[] | undefined, inspection?: InspectionInput): unknown;
|
|
129
152
|
|
|
130
153
|
type SsrfTier = 'metadata' | 'link-local' | 'multicast' | 'unspecified' | 'cgnat' | 'private';
|
|
131
154
|
interface SsrfMatch {
|
|
@@ -305,6 +328,10 @@ interface CatalogSettings {
|
|
|
305
328
|
enabled?: boolean;
|
|
306
329
|
onMalicious?: string;
|
|
307
330
|
};
|
|
331
|
+
untrustedContent?: {
|
|
332
|
+
enabled?: boolean;
|
|
333
|
+
afterExposure?: string;
|
|
334
|
+
};
|
|
308
335
|
/** Shields the host actually injected (`policy.appliedShields`). */
|
|
309
336
|
appliedShields?: readonly string[];
|
|
310
337
|
/**
|
|
@@ -356,6 +383,18 @@ declare function resolveCheckMap(settings: CatalogSettings): Record<string, Verd
|
|
|
356
383
|
declare const SYSTEM_AUTH_FILES: readonly ["/etc/passwd", "/etc/shadow", "/etc/group", "/etc/gshadow", "/etc/sudoers"];
|
|
357
384
|
declare const SYSTEM_AUTH_DIRS: readonly ["/etc/security", "/etc/pam.d", "/etc/sudoers.d"];
|
|
358
385
|
declare const STARTUP_NAMES: readonly [".bashrc", ".zshrc", ".profile", ".bash_profile"];
|
|
386
|
+
/**
|
|
387
|
+
* Files inside a project that run code or instruct the agent (fw#318 P4,
|
|
388
|
+
* design 6). A write there after the session read outside content is held:
|
|
389
|
+
* it is how an injected instruction persists past the session. Relative to
|
|
390
|
+
* the project root; a directory entry covers everything under it.
|
|
391
|
+
*/
|
|
392
|
+
declare const AGENT_INSTRUCTION_FILES: readonly [".gitlab-ci.yml", "CLAUDE.md", "AGENTS.md", ".cursorrules", ".mcp.json", ".vscode/settings.json", "package.json"];
|
|
393
|
+
declare const AGENT_INSTRUCTION_DIRS: readonly [".github/workflows", ".claude", ".cursor", ".git/hooks", ".husky"];
|
|
394
|
+
/** Is `absPath` one of the agent-instruction files of the project at `root`? */
|
|
395
|
+
declare function isAgentInstructionPath(absPath: string, root: string): boolean;
|
|
396
|
+
/** `isInside(root, p)`: `p` is `root` or below it, lexically. */
|
|
397
|
+
declare function isInside(root: string, p: string): boolean;
|
|
359
398
|
declare function isPasswordHashPath(p: string): boolean;
|
|
360
399
|
/** Compatibility only: old callers do not tell DLP whether they read or write. */
|
|
361
400
|
declare function isLegacySystemPath(p: string): boolean;
|
|
@@ -492,7 +531,7 @@ declare const COMMAND_WRAPPERS: Set<string>;
|
|
|
492
531
|
* `run_shell_command`, `execute_bash`, `terminal.execute`) must not silently
|
|
493
532
|
* void them. An absent rule scope matches everything (callers' prior semantics).
|
|
494
533
|
*/
|
|
495
|
-
declare function toolMatchesRule(toolName: string, ruleTool: string | string[] | undefined, toolInspection?:
|
|
534
|
+
declare function toolMatchesRule(toolName: string, ruleTool: string | string[] | undefined, toolInspection?: InspectionInput): boolean;
|
|
496
535
|
/** Strip leading wrappers/runners from a resolved arg list, returning the index
|
|
497
536
|
* of the real command head. Handles `sudo -u www python3`, `env -u FOO python3`,
|
|
498
537
|
* `timeout 5 python3`, `uv run python`, `conda run -n env python`,
|
|
@@ -670,6 +709,8 @@ interface PolicyConfig {
|
|
|
670
709
|
dangerousWords: string[];
|
|
671
710
|
ignoredTools: string[];
|
|
672
711
|
toolInspection: ToolInspection;
|
|
712
|
+
/** Entries from a repository-carried config file; they may only add inspection. */
|
|
713
|
+
projectToolInspection?: ToolInspection;
|
|
673
714
|
smartRules: SmartRule[];
|
|
674
715
|
dlp: {
|
|
675
716
|
enabled: boolean;
|
|
@@ -823,7 +864,7 @@ type ProtectedFileVerdict = PolicyVerdict & {
|
|
|
823
864
|
declare function incompleteFileVerdict(operation?: FileAccess['operation']): ProtectedFileVerdict;
|
|
824
865
|
/** Closed adapters: an arbitrary tool's path-shaped argument is not an operation. */
|
|
825
866
|
declare function fileToolOperation(tool: string, args: unknown): FileAccess['operation'] | null;
|
|
826
|
-
declare function collectFileAccesses(tool: string, args: unknown, context?: FileAccessContext, inspection?:
|
|
867
|
+
declare function collectFileAccesses(tool: string, args: unknown, context?: FileAccessContext, inspection?: InspectionInput): FileAccess[];
|
|
827
868
|
declare function evaluateProtectedFileAccess(accesses: FileAccess[], context: FileAccessContext, settings: CatalogSettings): ProtectedFileVerdict | null;
|
|
828
869
|
|
|
829
870
|
type InjectionConfidence = 'low' | 'medium' | 'high';
|
|
@@ -836,6 +877,10 @@ interface InjectionContext {
|
|
|
836
877
|
/** Tool that produced the output. Untrusted origins (web/network) raise
|
|
837
878
|
* confidence — a fetched page is attacker-influenceable; a local read isn't. */
|
|
838
879
|
tool?: string;
|
|
880
|
+
/** The caller's own answer to "did this output come from outside?" (the
|
|
881
|
+
* #318 source roles: an unannotated MCP tool, a shell fetch). When set it
|
|
882
|
+
* decides the booster; when absent the tool-name regex below does. */
|
|
883
|
+
untrusted?: boolean;
|
|
839
884
|
}
|
|
840
885
|
/**
|
|
841
886
|
* Scan tool output for indirect prompt injection. Returns the matched signals +
|
|
@@ -1033,6 +1078,12 @@ interface LegacyPolicyKnobs {
|
|
|
1033
1078
|
onlineFallback?: boolean;
|
|
1034
1079
|
allow?: string[];
|
|
1035
1080
|
};
|
|
1081
|
+
untrustedContent?: {
|
|
1082
|
+
enabled?: boolean;
|
|
1083
|
+
spotlight?: boolean;
|
|
1084
|
+
afterExposure?: string;
|
|
1085
|
+
orgDomains?: string[];
|
|
1086
|
+
};
|
|
1036
1087
|
}
|
|
1037
1088
|
interface TuningField {
|
|
1038
1089
|
checkId: string;
|
|
@@ -1127,6 +1178,68 @@ declare function extractPositionalArgs(tokens: string[], binary: string): string
|
|
|
1127
1178
|
*/
|
|
1128
1179
|
declare function extractNetworkTargets(tokens: string[], binary: string): string[];
|
|
1129
1180
|
|
|
1181
|
+
type DestinationKind = 'email' | 'host' | 'iban' | 'account';
|
|
1182
|
+
/** Upper bound on values kept from one text or one call. */
|
|
1183
|
+
declare const MAX_DESTINATIONS = 200;
|
|
1184
|
+
/**
|
|
1185
|
+
* Every destination-like value in a text a tool returned (or a prompt the
|
|
1186
|
+
* user typed). Emails anywhere; hosts only from URLs with a scheme or a
|
|
1187
|
+
* `www.` prefix; IBANs only when the checksum holds.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function extractContentDestinations(text: string): string[];
|
|
1190
|
+
/**
|
|
1191
|
+
* Every destination-like value in a tool call's arguments. Like the content
|
|
1192
|
+
* extractor, plus: a string under a recipient key (`to`, `recipient`, ...)
|
|
1193
|
+
* counts as a host when it is a bare hostname, so `send_money {recipient:
|
|
1194
|
+
* "US12..."}` and `send_email {to: "x@y.z"}` both yield their destination.
|
|
1195
|
+
*/
|
|
1196
|
+
declare function extractArgDestinations(args: unknown): string[];
|
|
1197
|
+
/** `email:a@b.c` -> `b.c`; other kinds have no domain. */
|
|
1198
|
+
declare function destinationDomain(dest: string): string | null;
|
|
1199
|
+
/** The kind prefix of a normalised destination. */
|
|
1200
|
+
declare function destinationKind(dest: string): DestinationKind | null;
|
|
1201
|
+
/** The value a person reads, without the kind prefix. */
|
|
1202
|
+
declare function destinationValue(dest: string): string;
|
|
1203
|
+
/** A loopback host: the machine itself (`localhost`, `*.localhost`,
|
|
1204
|
+
* 127.0.0.0/8, `::1`, `0.0.0.0`). A send there never leaves the machine. */
|
|
1205
|
+
declare function isLoopbackHost(host: string): boolean;
|
|
1206
|
+
/**
|
|
1207
|
+
* The repository a git url names, as `host/owner/name` lower-cased with
|
|
1208
|
+
* `.git` and slashes trimmed: https, ssh://, scp-like `git@host:owner/name`.
|
|
1209
|
+
* Null for a local path or a url without a path.
|
|
1210
|
+
*/
|
|
1211
|
+
declare function gitRepoPath(url: string): string | null;
|
|
1212
|
+
declare function isDestructiveToolName(bareTool: string): boolean;
|
|
1213
|
+
|
|
1214
|
+
interface ShellExposure {
|
|
1215
|
+
/** The command brings outside content in: its output is a source. */
|
|
1216
|
+
fetches: boolean;
|
|
1217
|
+
/** The command carries something out: the call is an action. */
|
|
1218
|
+
sends: boolean;
|
|
1219
|
+
/** Normalised destinations of the sending calls ('host:x.example'). */
|
|
1220
|
+
destinations: string[];
|
|
1221
|
+
/** `git push <remote-name>`: the remote names used, for the host to resolve;
|
|
1222
|
+
* '' is a push with no target (the branch's default remote). */
|
|
1223
|
+
gitRemotes: string[];
|
|
1224
|
+
/**
|
|
1225
|
+
* Repositories the git-host sends reach, `host/owner/name`. A host is not
|
|
1226
|
+
* enough there: github.com holds the project's origin and every attacker's
|
|
1227
|
+
* mirror. `host/*` is a repository the command does not name (a gist, a new
|
|
1228
|
+
* repository, a GraphQL call). A send to the current repository (`gh issue
|
|
1229
|
+
* comment 7`) names none.
|
|
1230
|
+
*/
|
|
1231
|
+
repos: string[];
|
|
1232
|
+
/** A send whose target this command makes unknowable (`cd x && git push`,
|
|
1233
|
+
* `git -C x push`, a dynamic `-R`): held after exposure. */
|
|
1234
|
+
unresolved: boolean;
|
|
1235
|
+
/** Hosts the fetching calls reach ('host:x.example'), literal prefixes of dynamic URLs included. */
|
|
1236
|
+
fetchDestinations: string[];
|
|
1237
|
+
/** Short labels of the fetching calls ('curl', 'gh issue', 'git pull'), for the frame. */
|
|
1238
|
+
fetchKinds: string[];
|
|
1239
|
+
}
|
|
1240
|
+
/** Classify a shell command as a source, a sink, both or neither. Never throws. */
|
|
1241
|
+
declare function classifyShellExposure(command: string): ShellExposure;
|
|
1242
|
+
|
|
1130
1243
|
/**
|
|
1131
1244
|
* Glob match a tool name against one pattern or a list, with case-insensitive
|
|
1132
1245
|
* matching and a leading-`./` tolerance: `./bin/foo` matches `bin/foo` and
|
|
@@ -1779,7 +1892,7 @@ interface ExtractContext {
|
|
|
1779
1892
|
}>;
|
|
1780
1893
|
/** toolInspection map from PolicyConfig — drives shell-command extraction
|
|
1781
1894
|
* for tools that aren't the standard 'bash' name. Defaults handled by caller. */
|
|
1782
|
-
toolInspection:
|
|
1895
|
+
toolInspection: InspectionInput;
|
|
1783
1896
|
/** DLP enabled flag from PolicyConfig. */
|
|
1784
1897
|
dlpEnabled: boolean;
|
|
1785
1898
|
/** Decoy credentials registered on this machine (value plus kind and plant
|
|
@@ -1837,7 +1950,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
1837
1950
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
1838
1951
|
* is loud, not silent.
|
|
1839
1952
|
*/
|
|
1840
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
1953
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v26";
|
|
1841
1954
|
/**
|
|
1842
1955
|
* SHA-256 prefix of the detector-source files
|
|
1843
1956
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -1848,7 +1961,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v25";
|
|
|
1848
1961
|
* files changed, this hash must change too, and you must consciously
|
|
1849
1962
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
1850
1963
|
*/
|
|
1851
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
1964
|
+
declare const CANONICAL_EXTRACTOR_HASH = "dec8c65145686360";
|
|
1852
1965
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
1853
1966
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
1854
1967
|
/**
|
|
@@ -1923,7 +2036,7 @@ declare function ssrfDestinationFloor(toolName: string, args: unknown, opts?: {
|
|
|
1923
2036
|
declare const ARGUMENT_SCAN_LIMITS: {
|
|
1924
2037
|
readonly maxDepth: 12;
|
|
1925
2038
|
readonly maxNodes: 16384;
|
|
1926
|
-
/**
|
|
2039
|
+
/** Text is matched and decoded in windows of this size. */
|
|
1927
2040
|
readonly maxStringCharacters: 100000;
|
|
1928
2041
|
/** Windows overlap by this much so a token on a window edge is still seen whole. */
|
|
1929
2042
|
readonly windowOverlap: 4096;
|
|
@@ -1936,10 +2049,11 @@ declare const ARGUMENT_SCAN_LIMITS: {
|
|
|
1936
2049
|
interface ArgumentInspectionResult {
|
|
1937
2050
|
match: DlpMatch | null;
|
|
1938
2051
|
/**
|
|
1939
|
-
* `incomplete` when any part of the input was not fully inspected
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
2052
|
+
* `incomplete` when any part of the input was not fully inspected: raw text
|
|
2053
|
+
* or structure skipped (`argument-*`), a decoding layer past the nested
|
|
2054
|
+
* limits (`decode-nested`), a flood of joinable hostname labels
|
|
2055
|
+
* (`decode-labels`), or the recovery-phrase hash budget (`mnemonic-budget`).
|
|
2056
|
+
* Every reason requires review; none is a documented allow.
|
|
1943
2057
|
*/
|
|
1944
2058
|
coverage: 'complete' | 'incomplete';
|
|
1945
2059
|
reasons: string[];
|
|
@@ -1947,14 +2061,13 @@ interface ArgumentInspectionResult {
|
|
|
1947
2061
|
/** Bounded input inspection. Output redaction deliberately retains its own API. */
|
|
1948
2062
|
declare function inspectArgumentSecrets(args: unknown): ArgumentInspectionResult;
|
|
1949
2063
|
/**
|
|
1950
|
-
* Existing DLP approval routing. A finding wins. Otherwise
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1953
|
-
* call, because ordinary documents full of links or hashes exhaust it.
|
|
2064
|
+
* Existing DLP approval routing. A finding wins. Otherwise any part of the
|
|
2065
|
+
* input that was not fully inspected requires review: there is no limit an
|
|
2066
|
+
* attacker can reach that ends in a clean result.
|
|
1954
2067
|
*/
|
|
1955
2068
|
declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
|
|
1956
2069
|
|
|
1957
2070
|
/** Engine version stamped on audit entries for future drift detection. */
|
|
1958
2071
|
declare const ENGINE_VERSION = "1.4.0";
|
|
1959
2072
|
|
|
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 };
|
|
2073
|
+
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, type InspectionInput, type InspectionLayers, 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, inspectionEntry, inspectionLayers, 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 | {
|
|
@@ -110,6 +113,19 @@ type ToolInspectionEntry = string | {
|
|
|
110
113
|
field: string;
|
|
111
114
|
};
|
|
112
115
|
type ToolInspection = Record<string, ToolInspectionEntry>;
|
|
116
|
+
/**
|
|
117
|
+
* Inspection mappings by provenance. `trusted` is the shipped defaults plus the
|
|
118
|
+
* user's own and the workspace's entries, with full authority. `project` is a
|
|
119
|
+
* repository-carried config file, which an agent can write in-session: it may
|
|
120
|
+
* add a shell tool or a shell field, never turn a recognized executor into a
|
|
121
|
+
* non-shell tool or point its inspection at a decoy field (fw#338, review 3).
|
|
122
|
+
*/
|
|
123
|
+
interface InspectionLayers {
|
|
124
|
+
trusted: ToolInspection;
|
|
125
|
+
project?: ToolInspection;
|
|
126
|
+
}
|
|
127
|
+
/** A plain map is read as trusted with no project layer. */
|
|
128
|
+
type InspectionInput = ToolInspection | InspectionLayers;
|
|
113
129
|
type ShellInputResolution = {
|
|
114
130
|
kind: 'not-shell';
|
|
115
131
|
} | {
|
|
@@ -122,10 +138,17 @@ type ShellInputResolution = {
|
|
|
122
138
|
};
|
|
123
139
|
declare const BASH_TOOL_NAMES: Set<string>;
|
|
124
140
|
declare function isBashTool(tool: string): boolean;
|
|
125
|
-
|
|
126
|
-
declare function
|
|
141
|
+
/** The merged policy's maps as layers; the host keeps the project layer apart. */
|
|
142
|
+
declare function inspectionLayers(policy: {
|
|
143
|
+
toolInspection: ToolInspection;
|
|
144
|
+
projectToolInspection?: ToolInspection;
|
|
145
|
+
}): InspectionLayers;
|
|
146
|
+
/** The first matching entry, trusted layer first. For legacy (SQL, explain) lookups. */
|
|
147
|
+
declare function inspectionEntry(tool: string, inspection?: InspectionInput): ToolInspectionEntry | undefined;
|
|
148
|
+
declare function isShellShapedTool(tool: string, inspection?: InspectionInput): boolean;
|
|
149
|
+
declare function resolveShellInput(tool: string, args: unknown, inspection?: InspectionInput): ShellInputResolution;
|
|
127
150
|
/** Only Bash-scoped rules receive the canonical projection. Caller data is never mutated. */
|
|
128
|
-
declare function shellRuleArgs(tool: string, args: unknown, ruleTool: string | string[] | undefined, inspection?:
|
|
151
|
+
declare function shellRuleArgs(tool: string, args: unknown, ruleTool: string | string[] | undefined, inspection?: InspectionInput): unknown;
|
|
129
152
|
|
|
130
153
|
type SsrfTier = 'metadata' | 'link-local' | 'multicast' | 'unspecified' | 'cgnat' | 'private';
|
|
131
154
|
interface SsrfMatch {
|
|
@@ -305,6 +328,10 @@ interface CatalogSettings {
|
|
|
305
328
|
enabled?: boolean;
|
|
306
329
|
onMalicious?: string;
|
|
307
330
|
};
|
|
331
|
+
untrustedContent?: {
|
|
332
|
+
enabled?: boolean;
|
|
333
|
+
afterExposure?: string;
|
|
334
|
+
};
|
|
308
335
|
/** Shields the host actually injected (`policy.appliedShields`). */
|
|
309
336
|
appliedShields?: readonly string[];
|
|
310
337
|
/**
|
|
@@ -356,6 +383,18 @@ declare function resolveCheckMap(settings: CatalogSettings): Record<string, Verd
|
|
|
356
383
|
declare const SYSTEM_AUTH_FILES: readonly ["/etc/passwd", "/etc/shadow", "/etc/group", "/etc/gshadow", "/etc/sudoers"];
|
|
357
384
|
declare const SYSTEM_AUTH_DIRS: readonly ["/etc/security", "/etc/pam.d", "/etc/sudoers.d"];
|
|
358
385
|
declare const STARTUP_NAMES: readonly [".bashrc", ".zshrc", ".profile", ".bash_profile"];
|
|
386
|
+
/**
|
|
387
|
+
* Files inside a project that run code or instruct the agent (fw#318 P4,
|
|
388
|
+
* design 6). A write there after the session read outside content is held:
|
|
389
|
+
* it is how an injected instruction persists past the session. Relative to
|
|
390
|
+
* the project root; a directory entry covers everything under it.
|
|
391
|
+
*/
|
|
392
|
+
declare const AGENT_INSTRUCTION_FILES: readonly [".gitlab-ci.yml", "CLAUDE.md", "AGENTS.md", ".cursorrules", ".mcp.json", ".vscode/settings.json", "package.json"];
|
|
393
|
+
declare const AGENT_INSTRUCTION_DIRS: readonly [".github/workflows", ".claude", ".cursor", ".git/hooks", ".husky"];
|
|
394
|
+
/** Is `absPath` one of the agent-instruction files of the project at `root`? */
|
|
395
|
+
declare function isAgentInstructionPath(absPath: string, root: string): boolean;
|
|
396
|
+
/** `isInside(root, p)`: `p` is `root` or below it, lexically. */
|
|
397
|
+
declare function isInside(root: string, p: string): boolean;
|
|
359
398
|
declare function isPasswordHashPath(p: string): boolean;
|
|
360
399
|
/** Compatibility only: old callers do not tell DLP whether they read or write. */
|
|
361
400
|
declare function isLegacySystemPath(p: string): boolean;
|
|
@@ -492,7 +531,7 @@ declare const COMMAND_WRAPPERS: Set<string>;
|
|
|
492
531
|
* `run_shell_command`, `execute_bash`, `terminal.execute`) must not silently
|
|
493
532
|
* void them. An absent rule scope matches everything (callers' prior semantics).
|
|
494
533
|
*/
|
|
495
|
-
declare function toolMatchesRule(toolName: string, ruleTool: string | string[] | undefined, toolInspection?:
|
|
534
|
+
declare function toolMatchesRule(toolName: string, ruleTool: string | string[] | undefined, toolInspection?: InspectionInput): boolean;
|
|
496
535
|
/** Strip leading wrappers/runners from a resolved arg list, returning the index
|
|
497
536
|
* of the real command head. Handles `sudo -u www python3`, `env -u FOO python3`,
|
|
498
537
|
* `timeout 5 python3`, `uv run python`, `conda run -n env python`,
|
|
@@ -670,6 +709,8 @@ interface PolicyConfig {
|
|
|
670
709
|
dangerousWords: string[];
|
|
671
710
|
ignoredTools: string[];
|
|
672
711
|
toolInspection: ToolInspection;
|
|
712
|
+
/** Entries from a repository-carried config file; they may only add inspection. */
|
|
713
|
+
projectToolInspection?: ToolInspection;
|
|
673
714
|
smartRules: SmartRule[];
|
|
674
715
|
dlp: {
|
|
675
716
|
enabled: boolean;
|
|
@@ -823,7 +864,7 @@ type ProtectedFileVerdict = PolicyVerdict & {
|
|
|
823
864
|
declare function incompleteFileVerdict(operation?: FileAccess['operation']): ProtectedFileVerdict;
|
|
824
865
|
/** Closed adapters: an arbitrary tool's path-shaped argument is not an operation. */
|
|
825
866
|
declare function fileToolOperation(tool: string, args: unknown): FileAccess['operation'] | null;
|
|
826
|
-
declare function collectFileAccesses(tool: string, args: unknown, context?: FileAccessContext, inspection?:
|
|
867
|
+
declare function collectFileAccesses(tool: string, args: unknown, context?: FileAccessContext, inspection?: InspectionInput): FileAccess[];
|
|
827
868
|
declare function evaluateProtectedFileAccess(accesses: FileAccess[], context: FileAccessContext, settings: CatalogSettings): ProtectedFileVerdict | null;
|
|
828
869
|
|
|
829
870
|
type InjectionConfidence = 'low' | 'medium' | 'high';
|
|
@@ -836,6 +877,10 @@ interface InjectionContext {
|
|
|
836
877
|
/** Tool that produced the output. Untrusted origins (web/network) raise
|
|
837
878
|
* confidence — a fetched page is attacker-influenceable; a local read isn't. */
|
|
838
879
|
tool?: string;
|
|
880
|
+
/** The caller's own answer to "did this output come from outside?" (the
|
|
881
|
+
* #318 source roles: an unannotated MCP tool, a shell fetch). When set it
|
|
882
|
+
* decides the booster; when absent the tool-name regex below does. */
|
|
883
|
+
untrusted?: boolean;
|
|
839
884
|
}
|
|
840
885
|
/**
|
|
841
886
|
* Scan tool output for indirect prompt injection. Returns the matched signals +
|
|
@@ -1033,6 +1078,12 @@ interface LegacyPolicyKnobs {
|
|
|
1033
1078
|
onlineFallback?: boolean;
|
|
1034
1079
|
allow?: string[];
|
|
1035
1080
|
};
|
|
1081
|
+
untrustedContent?: {
|
|
1082
|
+
enabled?: boolean;
|
|
1083
|
+
spotlight?: boolean;
|
|
1084
|
+
afterExposure?: string;
|
|
1085
|
+
orgDomains?: string[];
|
|
1086
|
+
};
|
|
1036
1087
|
}
|
|
1037
1088
|
interface TuningField {
|
|
1038
1089
|
checkId: string;
|
|
@@ -1127,6 +1178,68 @@ declare function extractPositionalArgs(tokens: string[], binary: string): string
|
|
|
1127
1178
|
*/
|
|
1128
1179
|
declare function extractNetworkTargets(tokens: string[], binary: string): string[];
|
|
1129
1180
|
|
|
1181
|
+
type DestinationKind = 'email' | 'host' | 'iban' | 'account';
|
|
1182
|
+
/** Upper bound on values kept from one text or one call. */
|
|
1183
|
+
declare const MAX_DESTINATIONS = 200;
|
|
1184
|
+
/**
|
|
1185
|
+
* Every destination-like value in a text a tool returned (or a prompt the
|
|
1186
|
+
* user typed). Emails anywhere; hosts only from URLs with a scheme or a
|
|
1187
|
+
* `www.` prefix; IBANs only when the checksum holds.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function extractContentDestinations(text: string): string[];
|
|
1190
|
+
/**
|
|
1191
|
+
* Every destination-like value in a tool call's arguments. Like the content
|
|
1192
|
+
* extractor, plus: a string under a recipient key (`to`, `recipient`, ...)
|
|
1193
|
+
* counts as a host when it is a bare hostname, so `send_money {recipient:
|
|
1194
|
+
* "US12..."}` and `send_email {to: "x@y.z"}` both yield their destination.
|
|
1195
|
+
*/
|
|
1196
|
+
declare function extractArgDestinations(args: unknown): string[];
|
|
1197
|
+
/** `email:a@b.c` -> `b.c`; other kinds have no domain. */
|
|
1198
|
+
declare function destinationDomain(dest: string): string | null;
|
|
1199
|
+
/** The kind prefix of a normalised destination. */
|
|
1200
|
+
declare function destinationKind(dest: string): DestinationKind | null;
|
|
1201
|
+
/** The value a person reads, without the kind prefix. */
|
|
1202
|
+
declare function destinationValue(dest: string): string;
|
|
1203
|
+
/** A loopback host: the machine itself (`localhost`, `*.localhost`,
|
|
1204
|
+
* 127.0.0.0/8, `::1`, `0.0.0.0`). A send there never leaves the machine. */
|
|
1205
|
+
declare function isLoopbackHost(host: string): boolean;
|
|
1206
|
+
/**
|
|
1207
|
+
* The repository a git url names, as `host/owner/name` lower-cased with
|
|
1208
|
+
* `.git` and slashes trimmed: https, ssh://, scp-like `git@host:owner/name`.
|
|
1209
|
+
* Null for a local path or a url without a path.
|
|
1210
|
+
*/
|
|
1211
|
+
declare function gitRepoPath(url: string): string | null;
|
|
1212
|
+
declare function isDestructiveToolName(bareTool: string): boolean;
|
|
1213
|
+
|
|
1214
|
+
interface ShellExposure {
|
|
1215
|
+
/** The command brings outside content in: its output is a source. */
|
|
1216
|
+
fetches: boolean;
|
|
1217
|
+
/** The command carries something out: the call is an action. */
|
|
1218
|
+
sends: boolean;
|
|
1219
|
+
/** Normalised destinations of the sending calls ('host:x.example'). */
|
|
1220
|
+
destinations: string[];
|
|
1221
|
+
/** `git push <remote-name>`: the remote names used, for the host to resolve;
|
|
1222
|
+
* '' is a push with no target (the branch's default remote). */
|
|
1223
|
+
gitRemotes: string[];
|
|
1224
|
+
/**
|
|
1225
|
+
* Repositories the git-host sends reach, `host/owner/name`. A host is not
|
|
1226
|
+
* enough there: github.com holds the project's origin and every attacker's
|
|
1227
|
+
* mirror. `host/*` is a repository the command does not name (a gist, a new
|
|
1228
|
+
* repository, a GraphQL call). A send to the current repository (`gh issue
|
|
1229
|
+
* comment 7`) names none.
|
|
1230
|
+
*/
|
|
1231
|
+
repos: string[];
|
|
1232
|
+
/** A send whose target this command makes unknowable (`cd x && git push`,
|
|
1233
|
+
* `git -C x push`, a dynamic `-R`): held after exposure. */
|
|
1234
|
+
unresolved: boolean;
|
|
1235
|
+
/** Hosts the fetching calls reach ('host:x.example'), literal prefixes of dynamic URLs included. */
|
|
1236
|
+
fetchDestinations: string[];
|
|
1237
|
+
/** Short labels of the fetching calls ('curl', 'gh issue', 'git pull'), for the frame. */
|
|
1238
|
+
fetchKinds: string[];
|
|
1239
|
+
}
|
|
1240
|
+
/** Classify a shell command as a source, a sink, both or neither. Never throws. */
|
|
1241
|
+
declare function classifyShellExposure(command: string): ShellExposure;
|
|
1242
|
+
|
|
1130
1243
|
/**
|
|
1131
1244
|
* Glob match a tool name against one pattern or a list, with case-insensitive
|
|
1132
1245
|
* matching and a leading-`./` tolerance: `./bin/foo` matches `bin/foo` and
|
|
@@ -1779,7 +1892,7 @@ interface ExtractContext {
|
|
|
1779
1892
|
}>;
|
|
1780
1893
|
/** toolInspection map from PolicyConfig — drives shell-command extraction
|
|
1781
1894
|
* for tools that aren't the standard 'bash' name. Defaults handled by caller. */
|
|
1782
|
-
toolInspection:
|
|
1895
|
+
toolInspection: InspectionInput;
|
|
1783
1896
|
/** DLP enabled flag from PolicyConfig. */
|
|
1784
1897
|
dlpEnabled: boolean;
|
|
1785
1898
|
/** Decoy credentials registered on this machine (value plus kind and plant
|
|
@@ -1837,7 +1950,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
1837
1950
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
1838
1951
|
* is loud, not silent.
|
|
1839
1952
|
*/
|
|
1840
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
1953
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v26";
|
|
1841
1954
|
/**
|
|
1842
1955
|
* SHA-256 prefix of the detector-source files
|
|
1843
1956
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -1848,7 +1961,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v25";
|
|
|
1848
1961
|
* files changed, this hash must change too, and you must consciously
|
|
1849
1962
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
1850
1963
|
*/
|
|
1851
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
1964
|
+
declare const CANONICAL_EXTRACTOR_HASH = "dec8c65145686360";
|
|
1852
1965
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
1853
1966
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
1854
1967
|
/**
|
|
@@ -1923,7 +2036,7 @@ declare function ssrfDestinationFloor(toolName: string, args: unknown, opts?: {
|
|
|
1923
2036
|
declare const ARGUMENT_SCAN_LIMITS: {
|
|
1924
2037
|
readonly maxDepth: 12;
|
|
1925
2038
|
readonly maxNodes: 16384;
|
|
1926
|
-
/**
|
|
2039
|
+
/** Text is matched and decoded in windows of this size. */
|
|
1927
2040
|
readonly maxStringCharacters: 100000;
|
|
1928
2041
|
/** Windows overlap by this much so a token on a window edge is still seen whole. */
|
|
1929
2042
|
readonly windowOverlap: 4096;
|
|
@@ -1936,10 +2049,11 @@ declare const ARGUMENT_SCAN_LIMITS: {
|
|
|
1936
2049
|
interface ArgumentInspectionResult {
|
|
1937
2050
|
match: DlpMatch | null;
|
|
1938
2051
|
/**
|
|
1939
|
-
* `incomplete` when any part of the input was not fully inspected
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
2052
|
+
* `incomplete` when any part of the input was not fully inspected: raw text
|
|
2053
|
+
* or structure skipped (`argument-*`), a decoding layer past the nested
|
|
2054
|
+
* limits (`decode-nested`), a flood of joinable hostname labels
|
|
2055
|
+
* (`decode-labels`), or the recovery-phrase hash budget (`mnemonic-budget`).
|
|
2056
|
+
* Every reason requires review; none is a documented allow.
|
|
1943
2057
|
*/
|
|
1944
2058
|
coverage: 'complete' | 'incomplete';
|
|
1945
2059
|
reasons: string[];
|
|
@@ -1947,14 +2061,13 @@ interface ArgumentInspectionResult {
|
|
|
1947
2061
|
/** Bounded input inspection. Output redaction deliberately retains its own API. */
|
|
1948
2062
|
declare function inspectArgumentSecrets(args: unknown): ArgumentInspectionResult;
|
|
1949
2063
|
/**
|
|
1950
|
-
* Existing DLP approval routing. A finding wins. Otherwise
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1953
|
-
* call, because ordinary documents full of links or hashes exhaust it.
|
|
2064
|
+
* Existing DLP approval routing. A finding wins. Otherwise any part of the
|
|
2065
|
+
* input that was not fully inspected requires review: there is no limit an
|
|
2066
|
+
* attacker can reach that ends in a clean result.
|
|
1954
2067
|
*/
|
|
1955
2068
|
declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
|
|
1956
2069
|
|
|
1957
2070
|
/** Engine version stamped on audit entries for future drift detection. */
|
|
1958
2071
|
declare const ENGINE_VERSION = "1.4.0";
|
|
1959
2072
|
|
|
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 };
|
|
2073
|
+
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, type InspectionInput, type InspectionLayers, 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, inspectionEntry, inspectionLayers, 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 };
|