@node9/policy-engine 2.13.1 → 2.14.1
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 +95 -3
- package/dist/index.d.ts +95 -3
- package/dist/index.js +832 -30
- package/dist/index.mjs +826 -30
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -207,6 +207,69 @@ declare function detectDangerousShellExec(command: string): 'block' | 'review' |
|
|
|
207
207
|
/** @deprecated Use detectDangerousShellExec — kept for backwards compatibility */
|
|
208
208
|
declare const detectDangerousEval: typeof detectDangerousShellExec;
|
|
209
209
|
declare const FS_READ_TOOLS: Set<string>;
|
|
210
|
+
interface PatternShape {
|
|
211
|
+
/** Flags MEASURED to consume the next word as a value. */
|
|
212
|
+
takesValue: Set<string>;
|
|
213
|
+
/**
|
|
214
|
+
* Flags MEASURED to consume NOTHING. Needed POSITIVELY, which is the lesson of
|
|
215
|
+
* /code-review round 2: the first cut excused "the first positional whose
|
|
216
|
+
* preceding flag is not known to consume", so an UNLISTED value-taking flag
|
|
217
|
+
* handed its own operand to the excuse. `grep --include-from KEY needle
|
|
218
|
+
* notes.txt` opened KEY under ugrep and read ALLOW. The comment that shipped
|
|
219
|
+
* with round 1 -- "a flag MISSING from the table only leaves a false positive"
|
|
220
|
+
* -- was wrong, and wrong in the unsafe direction.
|
|
221
|
+
*
|
|
222
|
+
* So the flag before a candidate word has THREE states, not two:
|
|
223
|
+
* in noValue -> the next word really is the first positional: excusable
|
|
224
|
+
* in takesValue -> that word is the flag's value: skip it and keep looking
|
|
225
|
+
* UNKNOWN -> excuse NOTHING in this command
|
|
226
|
+
* Unknown is the safe state: it leaves a false positive, never a bypass. That
|
|
227
|
+
* is what makes this table's incompleteness safe, which no flag list can be on
|
|
228
|
+
* its own -- and it has to be, because `grep` is not one program (GNU grep,
|
|
229
|
+
* ugrep, busybox) and the engine cannot know which one will run.
|
|
230
|
+
*/
|
|
231
|
+
noValue: Set<string>;
|
|
232
|
+
/** Flags whose operand IS the search pattern. */
|
|
233
|
+
patternFlags: Set<string>;
|
|
234
|
+
/** Flags after which NO positional pattern is expected (pattern from a file,
|
|
235
|
+
* or a listing mode). */
|
|
236
|
+
noPatternFlags: Set<string>;
|
|
237
|
+
}
|
|
238
|
+
/** Exported so the spec DERIVES its control rows from the table rather than
|
|
239
|
+
* hand-writing them: a flag added here gains a row for free. */
|
|
240
|
+
declare const PATTERN_VERB_NAMES: string[];
|
|
241
|
+
declare const patternShapeOf: (verb: string) => PatternShape | undefined;
|
|
242
|
+
/** JAIL-10's table, exported for the same reason: the spec derives the split
|
|
243
|
+
* between "operand is a FILE the verb opens" and "operand is an argument". */
|
|
244
|
+
declare const fileOperandFlagsOf: (verb: string) => Set<string> | undefined;
|
|
245
|
+
/** How a copy verb's arguments are read. */
|
|
246
|
+
interface CopyShape {
|
|
247
|
+
/**
|
|
248
|
+
* allButLast cp SRC... DEST (GNU -t moves DEST into a flag: every slot is a source)
|
|
249
|
+
* first ln TARGET LINK
|
|
250
|
+
* all gzip -c FILE
|
|
251
|
+
* archive tar/zip/ar/7z: the inputs after the archive slot, in a WRITING mode
|
|
252
|
+
* flagOperand the source is a flag's operand: az ... upload -f SRC / --file SRC
|
|
253
|
+
*/
|
|
254
|
+
source: 'allButLast' | 'first' | 'all' | 'archive' | 'flagOperand';
|
|
255
|
+
archive?: 'tar' | 'zip' | 'ar' | '7z';
|
|
256
|
+
/** flagOperand: the flags (short letter or long name) whose operand is the source. */
|
|
257
|
+
sourceFlags?: string[];
|
|
258
|
+
/** GNU `-t DIR` / `--target-directory`: the destination is in a flag. */
|
|
259
|
+
targetDirFlag?: boolean;
|
|
260
|
+
/** Flags whose operand is NEVER a source: a short LETTER ('i') or a long name ('--exclude'). */
|
|
261
|
+
skipFlags?: string[];
|
|
262
|
+
/**
|
|
263
|
+
* Short LETTERS this verb's getopt treats as taking an argument. Needed to read
|
|
264
|
+
* a bundle the way getopt does: the FIRST such letter swallows the rest of the
|
|
265
|
+
* token, so `-St` is `-S t` (suffix "t") and NOT `--target-directory`.
|
|
266
|
+
* /code-review round 7 measured the cost of guessing: `cp -St ~/.ssh/id_rsa
|
|
267
|
+
* /tmp/stolen` copies the key on real coreutils 9.4 and produced no finding,
|
|
268
|
+
* because a `t` anywhere in the bundle was read as the target-directory flag.
|
|
269
|
+
*/
|
|
270
|
+
valueLetters?: string[];
|
|
271
|
+
}
|
|
272
|
+
declare const COPY_VERBS: Record<string, CopyShape>;
|
|
210
273
|
interface FsOpVerdict {
|
|
211
274
|
ruleName: string;
|
|
212
275
|
verdict: 'block' | 'review';
|
|
@@ -253,6 +316,29 @@ declare function detectInlineExec(command: string): boolean;
|
|
|
253
316
|
* the tool-managed cache allow-list. Used to gate `rm -rf` on home paths.
|
|
254
317
|
*/
|
|
255
318
|
declare function isProtectedHomePath(rawPath: string): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Extract literal-text positional arguments from a CallExpr. Skips flags
|
|
321
|
+
* (anything starting with `-`) and ParamExp/CmdSubst (dynamic) parts. Returns
|
|
322
|
+
* the resolved string for each arg that is purely literal text.
|
|
323
|
+
*/
|
|
324
|
+
/** A resolved, non-flag argument and where it sits. */
|
|
325
|
+
interface PositionedArg {
|
|
326
|
+
/** The resolved literal. */
|
|
327
|
+
value: string;
|
|
328
|
+
/** 0-based SLOT among non-flag words -- `cp SRC DEST`: SRC is 0, DEST is 1. */
|
|
329
|
+
index: number;
|
|
330
|
+
/** Absolute index in the resolved word list, for explainability. */
|
|
331
|
+
argv: number;
|
|
332
|
+
/** The flag immediately before this word (`ssh -i KEY`: '-i'), else null. */
|
|
333
|
+
afterFlag: string | null;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The positioned non-flag words of `words[from..to)`. A dynamic word (null)
|
|
337
|
+
* occupies no slot AND breaks the flag link -- `-v $SRC KEY` gives KEY no flag,
|
|
338
|
+
* because something unknowable sat between them. Its `.map(a => a.value)` is
|
|
339
|
+
* exactly the pre-stage-3 filter, which jail-position.spec.ts pins.
|
|
340
|
+
*/
|
|
341
|
+
declare function positionedArgs(words: (string | null)[], from?: number, to?: number): PositionedArg[];
|
|
256
342
|
interface ShellDestination {
|
|
257
343
|
/** Extracted hostname, lowercased (e.g. "evil.com", "10.0.0.5"). */
|
|
258
344
|
host: string;
|
|
@@ -295,6 +381,12 @@ interface ShellDestToken {
|
|
|
295
381
|
*/
|
|
296
382
|
declare function extractShellDestTokens(command: string): ShellDestToken[];
|
|
297
383
|
declare function analyzeFsOperation(command: string): FsOpVerdict | null;
|
|
384
|
+
/**
|
|
385
|
+
* One representative command per copy verb, for a gate test that DERIVES its
|
|
386
|
+
* rows from COPY_VERBS instead of keeping a second hand list (the trap the
|
|
387
|
+
* prescreen comment above describes). `src` is the path being copied out.
|
|
388
|
+
*/
|
|
389
|
+
declare function sampleCopyCommand(verb: string, src: string): string;
|
|
298
390
|
interface ShellCommandAnalysis {
|
|
299
391
|
/** First word of every CallExpr — the command names invoked. */
|
|
300
392
|
actions: string[];
|
|
@@ -1203,7 +1295,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
1203
1295
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
1204
1296
|
* is loud, not silent.
|
|
1205
1297
|
*/
|
|
1206
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
1298
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v15";
|
|
1207
1299
|
/**
|
|
1208
1300
|
* SHA-256 prefix of the detector-source files
|
|
1209
1301
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -1214,7 +1306,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v13";
|
|
|
1214
1306
|
* files changed, this hash must change too, and you must consciously
|
|
1215
1307
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
1216
1308
|
*/
|
|
1217
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
1309
|
+
declare const CANONICAL_EXTRACTOR_HASH = "5dad4c8f07121f6c";
|
|
1218
1310
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
1219
1311
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
1220
1312
|
/**
|
|
@@ -1334,4 +1426,4 @@ declare function ssrfDestinationFloor(toolName: string, args: unknown, opts?: {
|
|
|
1334
1426
|
/** Engine version stamped on audit entries for future drift detection. */
|
|
1335
1427
|
declare const ENGINE_VERSION = "1.4.0";
|
|
1336
1428
|
|
|
1337
|
-
export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COMMAND_WRAPPERS, COST_PER_LOOP_ITER_USD, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, NET_BINARIES, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifySsrf, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeIpLiteral, parseAllSshHostsFromCommand, parseDestHost, previewArgs, redactText, resolvePinned, scanArgs, scanInjection, scanText, sensitivePathMatch, ssrfDestinationFloor, ssrfFloor, ssrfReason, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
|
|
1429
|
+
export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COMMAND_WRAPPERS, COPY_VERBS, COST_PER_LOOP_ITER_USD, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type PositionedArg, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifySsrf, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, fileOperandFlagsOf, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeIpLiteral, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolvePinned, sampleCopyCommand, scanArgs, scanInjection, scanText, sensitivePathMatch, ssrfDestinationFloor, ssrfFloor, ssrfReason, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
|
package/dist/index.d.ts
CHANGED
|
@@ -207,6 +207,69 @@ declare function detectDangerousShellExec(command: string): 'block' | 'review' |
|
|
|
207
207
|
/** @deprecated Use detectDangerousShellExec — kept for backwards compatibility */
|
|
208
208
|
declare const detectDangerousEval: typeof detectDangerousShellExec;
|
|
209
209
|
declare const FS_READ_TOOLS: Set<string>;
|
|
210
|
+
interface PatternShape {
|
|
211
|
+
/** Flags MEASURED to consume the next word as a value. */
|
|
212
|
+
takesValue: Set<string>;
|
|
213
|
+
/**
|
|
214
|
+
* Flags MEASURED to consume NOTHING. Needed POSITIVELY, which is the lesson of
|
|
215
|
+
* /code-review round 2: the first cut excused "the first positional whose
|
|
216
|
+
* preceding flag is not known to consume", so an UNLISTED value-taking flag
|
|
217
|
+
* handed its own operand to the excuse. `grep --include-from KEY needle
|
|
218
|
+
* notes.txt` opened KEY under ugrep and read ALLOW. The comment that shipped
|
|
219
|
+
* with round 1 -- "a flag MISSING from the table only leaves a false positive"
|
|
220
|
+
* -- was wrong, and wrong in the unsafe direction.
|
|
221
|
+
*
|
|
222
|
+
* So the flag before a candidate word has THREE states, not two:
|
|
223
|
+
* in noValue -> the next word really is the first positional: excusable
|
|
224
|
+
* in takesValue -> that word is the flag's value: skip it and keep looking
|
|
225
|
+
* UNKNOWN -> excuse NOTHING in this command
|
|
226
|
+
* Unknown is the safe state: it leaves a false positive, never a bypass. That
|
|
227
|
+
* is what makes this table's incompleteness safe, which no flag list can be on
|
|
228
|
+
* its own -- and it has to be, because `grep` is not one program (GNU grep,
|
|
229
|
+
* ugrep, busybox) and the engine cannot know which one will run.
|
|
230
|
+
*/
|
|
231
|
+
noValue: Set<string>;
|
|
232
|
+
/** Flags whose operand IS the search pattern. */
|
|
233
|
+
patternFlags: Set<string>;
|
|
234
|
+
/** Flags after which NO positional pattern is expected (pattern from a file,
|
|
235
|
+
* or a listing mode). */
|
|
236
|
+
noPatternFlags: Set<string>;
|
|
237
|
+
}
|
|
238
|
+
/** Exported so the spec DERIVES its control rows from the table rather than
|
|
239
|
+
* hand-writing them: a flag added here gains a row for free. */
|
|
240
|
+
declare const PATTERN_VERB_NAMES: string[];
|
|
241
|
+
declare const patternShapeOf: (verb: string) => PatternShape | undefined;
|
|
242
|
+
/** JAIL-10's table, exported for the same reason: the spec derives the split
|
|
243
|
+
* between "operand is a FILE the verb opens" and "operand is an argument". */
|
|
244
|
+
declare const fileOperandFlagsOf: (verb: string) => Set<string> | undefined;
|
|
245
|
+
/** How a copy verb's arguments are read. */
|
|
246
|
+
interface CopyShape {
|
|
247
|
+
/**
|
|
248
|
+
* allButLast cp SRC... DEST (GNU -t moves DEST into a flag: every slot is a source)
|
|
249
|
+
* first ln TARGET LINK
|
|
250
|
+
* all gzip -c FILE
|
|
251
|
+
* archive tar/zip/ar/7z: the inputs after the archive slot, in a WRITING mode
|
|
252
|
+
* flagOperand the source is a flag's operand: az ... upload -f SRC / --file SRC
|
|
253
|
+
*/
|
|
254
|
+
source: 'allButLast' | 'first' | 'all' | 'archive' | 'flagOperand';
|
|
255
|
+
archive?: 'tar' | 'zip' | 'ar' | '7z';
|
|
256
|
+
/** flagOperand: the flags (short letter or long name) whose operand is the source. */
|
|
257
|
+
sourceFlags?: string[];
|
|
258
|
+
/** GNU `-t DIR` / `--target-directory`: the destination is in a flag. */
|
|
259
|
+
targetDirFlag?: boolean;
|
|
260
|
+
/** Flags whose operand is NEVER a source: a short LETTER ('i') or a long name ('--exclude'). */
|
|
261
|
+
skipFlags?: string[];
|
|
262
|
+
/**
|
|
263
|
+
* Short LETTERS this verb's getopt treats as taking an argument. Needed to read
|
|
264
|
+
* a bundle the way getopt does: the FIRST such letter swallows the rest of the
|
|
265
|
+
* token, so `-St` is `-S t` (suffix "t") and NOT `--target-directory`.
|
|
266
|
+
* /code-review round 7 measured the cost of guessing: `cp -St ~/.ssh/id_rsa
|
|
267
|
+
* /tmp/stolen` copies the key on real coreutils 9.4 and produced no finding,
|
|
268
|
+
* because a `t` anywhere in the bundle was read as the target-directory flag.
|
|
269
|
+
*/
|
|
270
|
+
valueLetters?: string[];
|
|
271
|
+
}
|
|
272
|
+
declare const COPY_VERBS: Record<string, CopyShape>;
|
|
210
273
|
interface FsOpVerdict {
|
|
211
274
|
ruleName: string;
|
|
212
275
|
verdict: 'block' | 'review';
|
|
@@ -253,6 +316,29 @@ declare function detectInlineExec(command: string): boolean;
|
|
|
253
316
|
* the tool-managed cache allow-list. Used to gate `rm -rf` on home paths.
|
|
254
317
|
*/
|
|
255
318
|
declare function isProtectedHomePath(rawPath: string): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Extract literal-text positional arguments from a CallExpr. Skips flags
|
|
321
|
+
* (anything starting with `-`) and ParamExp/CmdSubst (dynamic) parts. Returns
|
|
322
|
+
* the resolved string for each arg that is purely literal text.
|
|
323
|
+
*/
|
|
324
|
+
/** A resolved, non-flag argument and where it sits. */
|
|
325
|
+
interface PositionedArg {
|
|
326
|
+
/** The resolved literal. */
|
|
327
|
+
value: string;
|
|
328
|
+
/** 0-based SLOT among non-flag words -- `cp SRC DEST`: SRC is 0, DEST is 1. */
|
|
329
|
+
index: number;
|
|
330
|
+
/** Absolute index in the resolved word list, for explainability. */
|
|
331
|
+
argv: number;
|
|
332
|
+
/** The flag immediately before this word (`ssh -i KEY`: '-i'), else null. */
|
|
333
|
+
afterFlag: string | null;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The positioned non-flag words of `words[from..to)`. A dynamic word (null)
|
|
337
|
+
* occupies no slot AND breaks the flag link -- `-v $SRC KEY` gives KEY no flag,
|
|
338
|
+
* because something unknowable sat between them. Its `.map(a => a.value)` is
|
|
339
|
+
* exactly the pre-stage-3 filter, which jail-position.spec.ts pins.
|
|
340
|
+
*/
|
|
341
|
+
declare function positionedArgs(words: (string | null)[], from?: number, to?: number): PositionedArg[];
|
|
256
342
|
interface ShellDestination {
|
|
257
343
|
/** Extracted hostname, lowercased (e.g. "evil.com", "10.0.0.5"). */
|
|
258
344
|
host: string;
|
|
@@ -295,6 +381,12 @@ interface ShellDestToken {
|
|
|
295
381
|
*/
|
|
296
382
|
declare function extractShellDestTokens(command: string): ShellDestToken[];
|
|
297
383
|
declare function analyzeFsOperation(command: string): FsOpVerdict | null;
|
|
384
|
+
/**
|
|
385
|
+
* One representative command per copy verb, for a gate test that DERIVES its
|
|
386
|
+
* rows from COPY_VERBS instead of keeping a second hand list (the trap the
|
|
387
|
+
* prescreen comment above describes). `src` is the path being copied out.
|
|
388
|
+
*/
|
|
389
|
+
declare function sampleCopyCommand(verb: string, src: string): string;
|
|
298
390
|
interface ShellCommandAnalysis {
|
|
299
391
|
/** First word of every CallExpr — the command names invoked. */
|
|
300
392
|
actions: string[];
|
|
@@ -1203,7 +1295,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
1203
1295
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
1204
1296
|
* is loud, not silent.
|
|
1205
1297
|
*/
|
|
1206
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
1298
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v15";
|
|
1207
1299
|
/**
|
|
1208
1300
|
* SHA-256 prefix of the detector-source files
|
|
1209
1301
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -1214,7 +1306,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v13";
|
|
|
1214
1306
|
* files changed, this hash must change too, and you must consciously
|
|
1215
1307
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
1216
1308
|
*/
|
|
1217
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
1309
|
+
declare const CANONICAL_EXTRACTOR_HASH = "5dad4c8f07121f6c";
|
|
1218
1310
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
1219
1311
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
1220
1312
|
/**
|
|
@@ -1334,4 +1426,4 @@ declare function ssrfDestinationFloor(toolName: string, args: unknown, opts?: {
|
|
|
1334
1426
|
/** Engine version stamped on audit entries for future drift detection. */
|
|
1335
1427
|
declare const ENGINE_VERSION = "1.4.0";
|
|
1336
1428
|
|
|
1337
|
-
export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COMMAND_WRAPPERS, COST_PER_LOOP_ITER_USD, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, NET_BINARIES, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifySsrf, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeIpLiteral, parseAllSshHostsFromCommand, parseDestHost, previewArgs, redactText, resolvePinned, scanArgs, scanInjection, scanText, sensitivePathMatch, ssrfDestinationFloor, ssrfFloor, ssrfReason, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
|
|
1429
|
+
export { AST_FS_REGEX_RULES, type AuditEntryForClassify, BASH_TOOL_NAMES, BUILTIN_SHIELDS, type BlastEnvFinding, type BlastFinding, type BlastResult, type BlastSummary, CANARY_MIN_LENGTH, CANONICAL_EXTRACTOR_HASH, CANONICAL_EXTRACTOR_VERSION, COMMAND_WRAPPERS, COPY_VERBS, COST_PER_LOOP_ITER_USD, type CanaryHit, type CanaryValue, type CanaryView, type CanonicalAgent, type CanonicalFinding, type CanonicalFindingType, type CanonicalSourceType, DEFAULT_EGRESS_ALLOWLIST, DESTINATION_ARGS, DESTRUCTIVE_OP_RE, DLP_PATTERNS, DLP_SCAN_LIMITS, type DlpMatch, ENGINE_VERSION, type EgressPolicy, type EgressVerdict, type ExtractContext, FILE_TOOLS, FLAGS_WITH_VALUES, FS_READ_TOOLS, type FsOpVerdict, type InjectionConfidence, type InjectionContext, type InjectionMatch, LONG_OUTPUT_THRESHOLD_BYTES, LOOP_MAX_RECORDS, LOOP_THRESHOLD_FOR_WASTE, type LoopWindowEvaluation, NET_BINARIES, PATTERN_VERB_NAMES, PRIVILEGE_ESCALATION_RE, type PiiPattern, type PipeChainAnalysis, type PolicyConfig, type PolicyContext, type PolicyHostHooks, type PolicyVerdict, type PositionedArg, type ProvenanceLookup, type ProvenanceTrust, REALTIME_PII_PATTERNS, type RiskMetadata, SCAN_SIGNAL_WEIGHTS, SENSITIVE_PATH_RE, SENSITIVE_PATH_REGEXES, SSRF_MAX_HOST, type ScanFinding, type ScanSignals, type ScanSummary, type ScoreTier, type SessionExtractContext, type SessionToolCall, type Severity, type ShellCommandAnalysis, type ShellDestToken, type ShellDestination, type ShieldDefinition, type ShieldOverrides, type ShieldVerdict, type SmartCondition, type SmartRule, type SsrfFloorOptions, type SsrfMatch, type SsrfTier, type SsrfVerdict, type ToolCallEntry, type ToolCallRecord, analyzeFsOperation, analyzePipeChain, analyzeShellCommand, checkDangerousSql, classifyAuditEntry, classifyRuleSeverity, classifyScanSignal, classifySsrf, computeAgentDeviceScore, computeArgsHash, computeBlendedSecurityScore, computeScanScore, computeSecurityScore, dedupeCanonicalFindings, detectArgsPii, detectDangerousEval, detectDangerousShellExec, detectInlineExec, detectPii, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateSmartConditions, extractAllSshHosts, extractCanonicalFindings, extractNetworkTargets, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, fileOperandFlagsOf, getCompiledRegex, getNestedValue, hostMatches, isBashTool, isIgnoredTool, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, narrativeRuleLabel, normalizeCommandForPolicy, normalizeIpLiteral, parseAllSshHostsFromCommand, parseDestHost, patternShapeOf, positionedArgs, previewArgs, redactText, resolvePinned, sampleCopyCommand, scanArgs, scanInjection, scanText, sensitivePathMatch, ssrfDestinationFloor, ssrfFloor, ssrfReason, summarizeBlast, summarizeScan, toScanFinding, toolMatchesRule, truncateBlastPath, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
|