@node9/policy-engine 2.33.0 → 2.33.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 +60 -3
- package/dist/index.d.ts +60 -3
- package/dist/index.js +288 -86
- package/dist/index.mjs +273 -84
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1211,6 +1211,63 @@ declare function isLoopbackHost(host: string): boolean;
|
|
|
1211
1211
|
declare function gitRepoPath(url: string): string | null;
|
|
1212
1212
|
declare function isDestructiveToolName(bareTool: string): boolean;
|
|
1213
1213
|
|
|
1214
|
+
/** The value as the gate compares it: email lower-cased, IBAN and account
|
|
1215
|
+
* upper-cased without spaces, host lower-cased. */
|
|
1216
|
+
declare function normalizeDestination(dest: string): string;
|
|
1217
|
+
/** 'iban:GB82 **** **** 5432', 'account:****5432', 'email:d***@acme.example';
|
|
1218
|
+
* a host (or anything else) is returned normalised and otherwise unchanged. */
|
|
1219
|
+
declare function maskDestination(dest: string): string;
|
|
1220
|
+
/** Whether a destination's kind is masked outside the machine. */
|
|
1221
|
+
declare function isMaskedKind(dest: string): boolean;
|
|
1222
|
+
/** SHA-256 (hex) of the normalised destination, kind prefix included. */
|
|
1223
|
+
declare function hashDestination(dest: string): string;
|
|
1224
|
+
/** Whether `entry` is a stored masked entry ('<masked>#sha256:<hex>'). */
|
|
1225
|
+
declare function isHashedEntry(entry: string): boolean;
|
|
1226
|
+
/** A full destination as it is stored on a trusted list outside the machine:
|
|
1227
|
+
* a masked kind becomes '<masked>#sha256:<hex>', a host stays as it is. */
|
|
1228
|
+
declare function trustedEntryOf(dest: string): string;
|
|
1229
|
+
/** Does a full destination match a stored entry (a hashed one, or a plain
|
|
1230
|
+
* value as the local list and older managed lists hold)? */
|
|
1231
|
+
declare function matchesTrustedEntry(dest: string, entry: string): boolean;
|
|
1232
|
+
/** Does a full destination match any entry of a list? Hashes it once. */
|
|
1233
|
+
declare function matchesTrustedList(dest: string, entries: readonly string[]): boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* A recipient as a person types it, in the stored destination form: an
|
|
1236
|
+
* address becomes `email:`, an IBAN `iban:`, a URL or hostname `host:`, and
|
|
1237
|
+
* `account:<number>` keeps its kind. A value that carries its kind is checked
|
|
1238
|
+
* against it. Null for anything else (a bare word, two values in one).
|
|
1239
|
+
*/
|
|
1240
|
+
declare function normalizeRecipient(raw: unknown): string | null;
|
|
1241
|
+
/**
|
|
1242
|
+
* One entry of a trusted list outside the machine (the dashboard's workspace
|
|
1243
|
+
* list, the snapshot's personal list): a host in full; an address, IBAN or
|
|
1244
|
+
* account as '<masked>#sha256:<hex>'. A value already in that form passes
|
|
1245
|
+
* with its hash lower-cased; a full value is turned into it. Null when it is
|
|
1246
|
+
* neither. The backend mirror asserts the same vectors.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function normalizeTrustedEntry(raw: unknown): string | null;
|
|
1249
|
+
/** What a person reads for an entry: the masked part, without the hash. */
|
|
1250
|
+
declare function entryDisplay(entry: string): string;
|
|
1251
|
+
/**
|
|
1252
|
+
* IBANs (mod-97), card numbers (exactly what detectPii reports, so not the
|
|
1253
|
+
* fractional part of a number), account numbers (a whole IBAN-shaped value,
|
|
1254
|
+
* or a number under an account key) and email addresses inside a text,
|
|
1255
|
+
* masked the way destinations are. No quote or backslash is introduced or
|
|
1256
|
+
* removed, so a JSON string stays a JSON string; a card written as a bare
|
|
1257
|
+
* JSON number does not stay a number, so arguments go through
|
|
1258
|
+
* maskPersonalValue instead.
|
|
1259
|
+
*/
|
|
1260
|
+
declare function maskPersonalData(text: string): string;
|
|
1261
|
+
/**
|
|
1262
|
+
* maskPersonalData over a JSON-shaped value (tool arguments), leaf by leaf, so
|
|
1263
|
+
* the result is always a value: a string leaf is masked in its JSON form under
|
|
1264
|
+
* its own key (the account-key and whole-value rules still see both), an
|
|
1265
|
+
* object key is masked as text, and a number whose text holds personal data (a
|
|
1266
|
+
* card passed as a number) becomes the masked string. Anything deeper than 64
|
|
1267
|
+
* levels is replaced by '[REDACTED]'. Pure, never throws.
|
|
1268
|
+
*/
|
|
1269
|
+
declare function maskPersonalValue(value: unknown): unknown;
|
|
1270
|
+
|
|
1214
1271
|
interface ShellExposure {
|
|
1215
1272
|
/** The command brings outside content in: its output is a source. */
|
|
1216
1273
|
fetches: boolean;
|
|
@@ -1950,7 +2007,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
1950
2007
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
1951
2008
|
* is loud, not silent.
|
|
1952
2009
|
*/
|
|
1953
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
2010
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
|
|
1954
2011
|
/**
|
|
1955
2012
|
* SHA-256 prefix of the detector-source files
|
|
1956
2013
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -1961,7 +2018,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v26";
|
|
|
1961
2018
|
* files changed, this hash must change too, and you must consciously
|
|
1962
2019
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
1963
2020
|
*/
|
|
1964
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
2021
|
+
declare const CANONICAL_EXTRACTOR_HASH = "a358f47eacca6e14";
|
|
1965
2022
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
1966
2023
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
1967
2024
|
/**
|
|
@@ -2070,4 +2127,4 @@ declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
|
|
|
2070
2127
|
/** Engine version stamped on audit entries for future drift detection. */
|
|
2071
2128
|
declare const ENGINE_VERSION = "1.4.0";
|
|
2072
2129
|
|
|
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 };
|
|
2130
|
+
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, entryDisplay, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hashDestination, hostMatches, incompleteFileVerdict, inspectArgumentSecrets, inspectionEntry, inspectionLayers, isAgentInstructionPath, isBashTool, isDestructiveToolName, isHashedEntry, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isMaskedKind, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, maskDestination, maskPersonalData, maskPersonalValue, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, matchesTrustedEntry, matchesTrustedList, narrativeRuleLabel, normalizeCommandForPolicy, normalizeDestination, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, normalizeRecipient, normalizeTrustedEntry, 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, trustedEntryOf, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
|
package/dist/index.d.ts
CHANGED
|
@@ -1211,6 +1211,63 @@ declare function isLoopbackHost(host: string): boolean;
|
|
|
1211
1211
|
declare function gitRepoPath(url: string): string | null;
|
|
1212
1212
|
declare function isDestructiveToolName(bareTool: string): boolean;
|
|
1213
1213
|
|
|
1214
|
+
/** The value as the gate compares it: email lower-cased, IBAN and account
|
|
1215
|
+
* upper-cased without spaces, host lower-cased. */
|
|
1216
|
+
declare function normalizeDestination(dest: string): string;
|
|
1217
|
+
/** 'iban:GB82 **** **** 5432', 'account:****5432', 'email:d***@acme.example';
|
|
1218
|
+
* a host (or anything else) is returned normalised and otherwise unchanged. */
|
|
1219
|
+
declare function maskDestination(dest: string): string;
|
|
1220
|
+
/** Whether a destination's kind is masked outside the machine. */
|
|
1221
|
+
declare function isMaskedKind(dest: string): boolean;
|
|
1222
|
+
/** SHA-256 (hex) of the normalised destination, kind prefix included. */
|
|
1223
|
+
declare function hashDestination(dest: string): string;
|
|
1224
|
+
/** Whether `entry` is a stored masked entry ('<masked>#sha256:<hex>'). */
|
|
1225
|
+
declare function isHashedEntry(entry: string): boolean;
|
|
1226
|
+
/** A full destination as it is stored on a trusted list outside the machine:
|
|
1227
|
+
* a masked kind becomes '<masked>#sha256:<hex>', a host stays as it is. */
|
|
1228
|
+
declare function trustedEntryOf(dest: string): string;
|
|
1229
|
+
/** Does a full destination match a stored entry (a hashed one, or a plain
|
|
1230
|
+
* value as the local list and older managed lists hold)? */
|
|
1231
|
+
declare function matchesTrustedEntry(dest: string, entry: string): boolean;
|
|
1232
|
+
/** Does a full destination match any entry of a list? Hashes it once. */
|
|
1233
|
+
declare function matchesTrustedList(dest: string, entries: readonly string[]): boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* A recipient as a person types it, in the stored destination form: an
|
|
1236
|
+
* address becomes `email:`, an IBAN `iban:`, a URL or hostname `host:`, and
|
|
1237
|
+
* `account:<number>` keeps its kind. A value that carries its kind is checked
|
|
1238
|
+
* against it. Null for anything else (a bare word, two values in one).
|
|
1239
|
+
*/
|
|
1240
|
+
declare function normalizeRecipient(raw: unknown): string | null;
|
|
1241
|
+
/**
|
|
1242
|
+
* One entry of a trusted list outside the machine (the dashboard's workspace
|
|
1243
|
+
* list, the snapshot's personal list): a host in full; an address, IBAN or
|
|
1244
|
+
* account as '<masked>#sha256:<hex>'. A value already in that form passes
|
|
1245
|
+
* with its hash lower-cased; a full value is turned into it. Null when it is
|
|
1246
|
+
* neither. The backend mirror asserts the same vectors.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function normalizeTrustedEntry(raw: unknown): string | null;
|
|
1249
|
+
/** What a person reads for an entry: the masked part, without the hash. */
|
|
1250
|
+
declare function entryDisplay(entry: string): string;
|
|
1251
|
+
/**
|
|
1252
|
+
* IBANs (mod-97), card numbers (exactly what detectPii reports, so not the
|
|
1253
|
+
* fractional part of a number), account numbers (a whole IBAN-shaped value,
|
|
1254
|
+
* or a number under an account key) and email addresses inside a text,
|
|
1255
|
+
* masked the way destinations are. No quote or backslash is introduced or
|
|
1256
|
+
* removed, so a JSON string stays a JSON string; a card written as a bare
|
|
1257
|
+
* JSON number does not stay a number, so arguments go through
|
|
1258
|
+
* maskPersonalValue instead.
|
|
1259
|
+
*/
|
|
1260
|
+
declare function maskPersonalData(text: string): string;
|
|
1261
|
+
/**
|
|
1262
|
+
* maskPersonalData over a JSON-shaped value (tool arguments), leaf by leaf, so
|
|
1263
|
+
* the result is always a value: a string leaf is masked in its JSON form under
|
|
1264
|
+
* its own key (the account-key and whole-value rules still see both), an
|
|
1265
|
+
* object key is masked as text, and a number whose text holds personal data (a
|
|
1266
|
+
* card passed as a number) becomes the masked string. Anything deeper than 64
|
|
1267
|
+
* levels is replaced by '[REDACTED]'. Pure, never throws.
|
|
1268
|
+
*/
|
|
1269
|
+
declare function maskPersonalValue(value: unknown): unknown;
|
|
1270
|
+
|
|
1214
1271
|
interface ShellExposure {
|
|
1215
1272
|
/** The command brings outside content in: its output is a source. */
|
|
1216
1273
|
fetches: boolean;
|
|
@@ -1950,7 +2007,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
1950
2007
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
1951
2008
|
* is loud, not silent.
|
|
1952
2009
|
*/
|
|
1953
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
2010
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
|
|
1954
2011
|
/**
|
|
1955
2012
|
* SHA-256 prefix of the detector-source files
|
|
1956
2013
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -1961,7 +2018,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v26";
|
|
|
1961
2018
|
* files changed, this hash must change too, and you must consciously
|
|
1962
2019
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
1963
2020
|
*/
|
|
1964
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
2021
|
+
declare const CANONICAL_EXTRACTOR_HASH = "a358f47eacca6e14";
|
|
1965
2022
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
1966
2023
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
1967
2024
|
/**
|
|
@@ -2070,4 +2127,4 @@ declare function scanArgumentSecrets(args: unknown): DlpMatch | null;
|
|
|
2070
2127
|
/** Engine version stamped on audit entries for future drift detection. */
|
|
2071
2128
|
declare const ENGINE_VERSION = "1.4.0";
|
|
2072
2129
|
|
|
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 };
|
|
2130
|
+
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, entryDisplay, evaluateEgress, evaluateLoopWindow, evaluatePolicy, evaluateProtectedFileAccess, evaluateSmartConditions, extractAllSshHosts, extractArgDestinations, extractCanonicalFindings, extractContentDestinations, extractNetworkTargets, extractPackageInstalls, extractPositionalArgs, extractSessionLevelFindings, extractShellDestTokens, extractShellDestinations, extractToolDestinations, fileOperandFlagsOf, fileToolOperation, foldHomoglyphs, getCheck, getCompiledRegex, getNestedValue, gitRepoPath, hashDestination, hostMatches, incompleteFileVerdict, inspectArgumentSecrets, inspectionEntry, inspectionLayers, isAgentInstructionPath, isBashTool, isDestructiveToolName, isHashedEntry, isIgnoredTool, isInside, isKnobGoverned, isLegacySystemPath, isLockedCheck, isLoopbackHost, isMaskedKind, isPasswordHashPath, isPrivateHost, isProtectedHomePath, isShellShapedTool, isShieldVerdict, isStrictGatedTier, isVerdict, maskDestination, maskPersonalData, maskPersonalValue, matchCanary, matchCanaryArgs, matchSensitivePath, matchesPattern, matchesTrustedEntry, matchesTrustedList, narrativeRuleLabel, normalizeCommandForPolicy, normalizeDestination, normalizeFilePath, normalizeForScan, normalizeIpLiteral, normalizePyPiName, normalizeRecipient, normalizeTrustedEntry, 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, trustedEntryOf, tuningFromLegacyPolicy, tuningToLegacyPolicy, unwrapCommandHead, validateOverrides, validateRegex, validateShieldDefinition };
|
package/dist/index.js
CHANGED
|
@@ -111,6 +111,7 @@ __export(src_exports, {
|
|
|
111
111
|
detectDangerousShellExec: () => detectDangerousShellExec,
|
|
112
112
|
detectInlineExec: () => detectInlineExec,
|
|
113
113
|
detectPii: () => detectPii,
|
|
114
|
+
entryDisplay: () => entryDisplay,
|
|
114
115
|
evaluateEgress: () => evaluateEgress,
|
|
115
116
|
evaluateLoopWindow: () => evaluateLoopWindow,
|
|
116
117
|
evaluatePolicy: () => evaluatePolicy,
|
|
@@ -134,6 +135,7 @@ __export(src_exports, {
|
|
|
134
135
|
getCompiledRegex: () => getCompiledRegex,
|
|
135
136
|
getNestedValue: () => getNestedValue,
|
|
136
137
|
gitRepoPath: () => gitRepoPath,
|
|
138
|
+
hashDestination: () => hashDestination,
|
|
137
139
|
hostMatches: () => hostMatches,
|
|
138
140
|
incompleteFileVerdict: () => incompleteFileVerdict,
|
|
139
141
|
inspectArgumentSecrets: () => inspectArgumentSecrets,
|
|
@@ -142,12 +144,14 @@ __export(src_exports, {
|
|
|
142
144
|
isAgentInstructionPath: () => isAgentInstructionPath,
|
|
143
145
|
isBashTool: () => isBashTool,
|
|
144
146
|
isDestructiveToolName: () => isDestructiveToolName,
|
|
147
|
+
isHashedEntry: () => isHashedEntry,
|
|
145
148
|
isIgnoredTool: () => isIgnoredTool,
|
|
146
149
|
isInside: () => isInside,
|
|
147
150
|
isKnobGoverned: () => isKnobGoverned,
|
|
148
151
|
isLegacySystemPath: () => isLegacySystemPath,
|
|
149
152
|
isLockedCheck: () => isLockedCheck,
|
|
150
153
|
isLoopbackHost: () => isLoopbackHost,
|
|
154
|
+
isMaskedKind: () => isMaskedKind,
|
|
151
155
|
isPasswordHashPath: () => isPasswordHashPath,
|
|
152
156
|
isPrivateHost: () => isPrivateHost,
|
|
153
157
|
isProtectedHomePath: () => isProtectedHomePath,
|
|
@@ -155,16 +159,24 @@ __export(src_exports, {
|
|
|
155
159
|
isShieldVerdict: () => isShieldVerdict,
|
|
156
160
|
isStrictGatedTier: () => isStrictGatedTier,
|
|
157
161
|
isVerdict: () => isVerdict,
|
|
162
|
+
maskDestination: () => maskDestination,
|
|
163
|
+
maskPersonalData: () => maskPersonalData,
|
|
164
|
+
maskPersonalValue: () => maskPersonalValue,
|
|
158
165
|
matchCanary: () => matchCanary,
|
|
159
166
|
matchCanaryArgs: () => matchCanaryArgs,
|
|
160
167
|
matchSensitivePath: () => matchSensitivePath2,
|
|
161
168
|
matchesPattern: () => matchesPattern,
|
|
169
|
+
matchesTrustedEntry: () => matchesTrustedEntry,
|
|
170
|
+
matchesTrustedList: () => matchesTrustedList,
|
|
162
171
|
narrativeRuleLabel: () => narrativeRuleLabel,
|
|
163
172
|
normalizeCommandForPolicy: () => normalizeCommandForPolicy,
|
|
173
|
+
normalizeDestination: () => normalizeDestination,
|
|
164
174
|
normalizeFilePath: () => normalizeFilePath,
|
|
165
175
|
normalizeForScan: () => normalizeForScan,
|
|
166
176
|
normalizeIpLiteral: () => normalizeIpLiteral,
|
|
167
177
|
normalizePyPiName: () => normalizePyPiName,
|
|
178
|
+
normalizeRecipient: () => normalizeRecipient,
|
|
179
|
+
normalizeTrustedEntry: () => normalizeTrustedEntry,
|
|
168
180
|
parseAllSshHostsFromCommand: () => parseAllSshHostsFromCommand,
|
|
169
181
|
parseDestHost: () => parseDestHost,
|
|
170
182
|
patternShapeOf: () => patternShapeOf,
|
|
@@ -198,6 +210,7 @@ __export(src_exports, {
|
|
|
198
210
|
toScanFinding: () => toScanFinding,
|
|
199
211
|
toolMatchesRule: () => toolMatchesRule,
|
|
200
212
|
truncateBlastPath: () => truncateBlastPath,
|
|
213
|
+
trustedEntryOf: () => trustedEntryOf,
|
|
201
214
|
tuningFromLegacyPolicy: () => tuningFromLegacyPolicy,
|
|
202
215
|
tuningToLegacyPolicy: () => tuningToLegacyPolicy,
|
|
203
216
|
unwrapCommandHead: () => unwrapCommandHead,
|
|
@@ -11531,6 +11544,264 @@ function isDestructiveToolName(bareTool) {
|
|
|
11531
11544
|
return DESTRUCTIVE_VERB_RE.test(bareTool);
|
|
11532
11545
|
}
|
|
11533
11546
|
|
|
11547
|
+
// src/exposure/mask.ts
|
|
11548
|
+
var import_crypto2 = require("crypto");
|
|
11549
|
+
|
|
11550
|
+
// src/scan/pii.ts
|
|
11551
|
+
var PII_EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/;
|
|
11552
|
+
var PII_SSN_RE = /\b\d{3}-\d{2}-\d{4}\b/;
|
|
11553
|
+
var PII_PHONE_RE = /\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]\d{3}[-.\s]\d{4}\b/;
|
|
11554
|
+
var PII_CC16_RE = /\b(?:4\d{3}|5[1-5]\d{2}|6\d{3})[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/;
|
|
11555
|
+
var PII_CC15_RE = /\b3[47]\d{2}[-\s]?\d{6}[-\s]?\d{5}\b/;
|
|
11556
|
+
var PII_IBAN_RE = /\b[A-Z]{2}\d{2}(?:[A-Z0-9]|[ -][A-Z0-9]){11,30}\b/;
|
|
11557
|
+
function* validCardRuns(text, base2) {
|
|
11558
|
+
const re = new RegExp(base2.source, "g");
|
|
11559
|
+
let m;
|
|
11560
|
+
while ((m = re.exec(text)) !== null) {
|
|
11561
|
+
const digits = m[0].replace(/\D/g, "");
|
|
11562
|
+
if (!isDecimalFraction(text, m.index, digits.length === m[0].length) && validateLuhn(digits)) {
|
|
11563
|
+
yield { index: m.index, length: m[0].length, digits };
|
|
11564
|
+
} else {
|
|
11565
|
+
re.lastIndex = m.index + 1;
|
|
11566
|
+
}
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
function hasValidCard(text) {
|
|
11570
|
+
for (const base2 of [PII_CC16_RE, PII_CC15_RE]) {
|
|
11571
|
+
if (!validCardRuns(text, base2).next().done) return true;
|
|
11572
|
+
}
|
|
11573
|
+
return false;
|
|
11574
|
+
}
|
|
11575
|
+
function replaceValidCards(text, replace) {
|
|
11576
|
+
let out = text;
|
|
11577
|
+
for (const base2 of [PII_CC16_RE, PII_CC15_RE]) {
|
|
11578
|
+
let res = "";
|
|
11579
|
+
let last = 0;
|
|
11580
|
+
for (const run of validCardRuns(out, base2)) {
|
|
11581
|
+
res += out.slice(last, run.index) + replace(run.digits);
|
|
11582
|
+
last = run.index + run.length;
|
|
11583
|
+
}
|
|
11584
|
+
out = res + out.slice(last);
|
|
11585
|
+
}
|
|
11586
|
+
return out;
|
|
11587
|
+
}
|
|
11588
|
+
var NUMBER_LEAD_RE = /[\s:=;([{"'+-]/;
|
|
11589
|
+
function isDecimalFraction(text, index, unseparated) {
|
|
11590
|
+
if (!unseparated) return false;
|
|
11591
|
+
const sep = text[index - 1];
|
|
11592
|
+
const a = text[index - 2];
|
|
11593
|
+
if (sep === ".") {
|
|
11594
|
+
if (a !== void 0 && a >= "0" && a <= "9") return true;
|
|
11595
|
+
return a === void 0 || NUMBER_LEAD_RE.test(a);
|
|
11596
|
+
}
|
|
11597
|
+
if (sep === "," && a === "0") {
|
|
11598
|
+
const b = text[index - 3];
|
|
11599
|
+
return b === void 0 || NUMBER_LEAD_RE.test(b);
|
|
11600
|
+
}
|
|
11601
|
+
return false;
|
|
11602
|
+
}
|
|
11603
|
+
function hasValidIban(text) {
|
|
11604
|
+
const re = new RegExp(PII_IBAN_RE.source, "g");
|
|
11605
|
+
let m;
|
|
11606
|
+
while ((m = re.exec(text)) !== null) {
|
|
11607
|
+
if (validateIban(m[0])) return true;
|
|
11608
|
+
re.lastIndex = m.index + 1;
|
|
11609
|
+
}
|
|
11610
|
+
return false;
|
|
11611
|
+
}
|
|
11612
|
+
function detectPii(text) {
|
|
11613
|
+
const found = /* @__PURE__ */ new Set();
|
|
11614
|
+
if (/@/.test(text) && PII_EMAIL_RE.test(text)) found.add("Email");
|
|
11615
|
+
if (/-/.test(text) && PII_SSN_RE.test(text)) found.add("SSN");
|
|
11616
|
+
if (PII_PHONE_RE.test(text)) found.add("Phone");
|
|
11617
|
+
if (hasValidCard(text)) found.add("Credit Card");
|
|
11618
|
+
if (hasValidIban(text)) found.add("IBAN");
|
|
11619
|
+
return [...found];
|
|
11620
|
+
}
|
|
11621
|
+
var REALTIME_PII_PATTERNS = ["SSN", "Credit Card", "IBAN"];
|
|
11622
|
+
var MAX_PII_SCAN_BYTES = 1e5;
|
|
11623
|
+
function* stringLeaves(v, depth = 0) {
|
|
11624
|
+
if (depth > 6) return;
|
|
11625
|
+
if (typeof v === "string") {
|
|
11626
|
+
if (v.length > 0) yield v;
|
|
11627
|
+
return;
|
|
11628
|
+
}
|
|
11629
|
+
if (typeof v === "number") {
|
|
11630
|
+
if (Number.isFinite(v)) yield String(v);
|
|
11631
|
+
return;
|
|
11632
|
+
}
|
|
11633
|
+
if (!v || typeof v !== "object") return;
|
|
11634
|
+
if (Array.isArray(v)) {
|
|
11635
|
+
for (const x of v) yield* stringLeaves(x, depth + 1);
|
|
11636
|
+
return;
|
|
11637
|
+
}
|
|
11638
|
+
for (const x of Object.values(v)) yield* stringLeaves(x, depth + 1);
|
|
11639
|
+
}
|
|
11640
|
+
function detectArgsPii(args) {
|
|
11641
|
+
if (args === null || args === void 0) return [];
|
|
11642
|
+
const found = /* @__PURE__ */ new Set();
|
|
11643
|
+
let budget = MAX_PII_SCAN_BYTES;
|
|
11644
|
+
try {
|
|
11645
|
+
for (const leaf of stringLeaves(args)) {
|
|
11646
|
+
if (budget <= 0) break;
|
|
11647
|
+
const t = leaf.length > budget ? leaf.slice(0, budget) : leaf;
|
|
11648
|
+
budget -= t.length;
|
|
11649
|
+
for (const p of detectPii(t)) {
|
|
11650
|
+
if (REALTIME_PII_PATTERNS.includes(p)) found.add(p);
|
|
11651
|
+
}
|
|
11652
|
+
}
|
|
11653
|
+
} catch {
|
|
11654
|
+
return [];
|
|
11655
|
+
}
|
|
11656
|
+
return [...found];
|
|
11657
|
+
}
|
|
11658
|
+
|
|
11659
|
+
// src/exposure/mask.ts
|
|
11660
|
+
var MASKED_KINDS = /* @__PURE__ */ new Set(["email", "iban", "account"]);
|
|
11661
|
+
var ENTRY_RE = /^(email|iban|account):([^#\s]{1,200}(?: [^#\s]{1,40}){0,4})#sha256:([0-9a-f]{64})$/;
|
|
11662
|
+
function split(dest) {
|
|
11663
|
+
const i = dest.indexOf(":");
|
|
11664
|
+
if (i <= 0) return null;
|
|
11665
|
+
return { kind: dest.slice(0, i).toLowerCase(), value: dest.slice(i + 1) };
|
|
11666
|
+
}
|
|
11667
|
+
function normalizeDestination(dest) {
|
|
11668
|
+
const p = split(dest.trim());
|
|
11669
|
+
if (!p) return dest.trim();
|
|
11670
|
+
if (p.kind === "iban" || p.kind === "account")
|
|
11671
|
+
return `${p.kind}:${p.value.replace(/\s+/g, "").toUpperCase()}`;
|
|
11672
|
+
return `${p.kind}:${p.value.toLowerCase()}`;
|
|
11673
|
+
}
|
|
11674
|
+
function maskEmailValue(address) {
|
|
11675
|
+
const at = address.lastIndexOf("@");
|
|
11676
|
+
if (at <= 0) return "***";
|
|
11677
|
+
return `${address[0]}***@${address.slice(at + 1)}`;
|
|
11678
|
+
}
|
|
11679
|
+
function maskDestination(dest) {
|
|
11680
|
+
const n = normalizeDestination(dest);
|
|
11681
|
+
const p = split(n);
|
|
11682
|
+
if (!p || !MASKED_KINDS.has(p.kind)) return n;
|
|
11683
|
+
if (p.kind === "iban") return `iban:${p.value.slice(0, 4)} **** **** ${p.value.slice(-4)}`;
|
|
11684
|
+
if (p.kind === "account") return `account:****${p.value.slice(-4)}`;
|
|
11685
|
+
return `email:${maskEmailValue(p.value)}`;
|
|
11686
|
+
}
|
|
11687
|
+
function isMaskedKind(dest) {
|
|
11688
|
+
const p = split(dest);
|
|
11689
|
+
return !!p && MASKED_KINDS.has(p.kind);
|
|
11690
|
+
}
|
|
11691
|
+
function hashDestination(dest) {
|
|
11692
|
+
return (0, import_crypto2.createHash)("sha256").update(normalizeDestination(dest), "utf8").digest("hex");
|
|
11693
|
+
}
|
|
11694
|
+
function isHashedEntry(entry) {
|
|
11695
|
+
return ENTRY_RE.test(entry);
|
|
11696
|
+
}
|
|
11697
|
+
function trustedEntryOf(dest) {
|
|
11698
|
+
const n = normalizeDestination(dest);
|
|
11699
|
+
if (!isMaskedKind(n)) return n;
|
|
11700
|
+
return `${maskDestination(n)}#sha256:${hashDestination(n)}`;
|
|
11701
|
+
}
|
|
11702
|
+
function matchesTrustedEntry(dest, entry) {
|
|
11703
|
+
const m = ENTRY_RE.exec(entry);
|
|
11704
|
+
if (m) return hashDestination(dest) === m[3];
|
|
11705
|
+
return normalizeDestination(dest) === normalizeDestination(entry);
|
|
11706
|
+
}
|
|
11707
|
+
function matchesTrustedList(dest, entries) {
|
|
11708
|
+
if (entries.length === 0) return false;
|
|
11709
|
+
const plain = normalizeDestination(dest);
|
|
11710
|
+
let hash2;
|
|
11711
|
+
for (const entry of entries) {
|
|
11712
|
+
const m = ENTRY_RE.exec(entry);
|
|
11713
|
+
if (m) {
|
|
11714
|
+
hash2 ??= hashDestination(dest);
|
|
11715
|
+
if (hash2 === m[3]) return true;
|
|
11716
|
+
} else if (plain === normalizeDestination(entry)) return true;
|
|
11717
|
+
}
|
|
11718
|
+
return false;
|
|
11719
|
+
}
|
|
11720
|
+
function normalizeRecipient(raw) {
|
|
11721
|
+
if (typeof raw !== "string") return null;
|
|
11722
|
+
const v = raw.trim();
|
|
11723
|
+
if (!v || v.length > 512) return null;
|
|
11724
|
+
const acct = /^account:([A-Za-z0-9 ]{8,40})$/i.exec(v);
|
|
11725
|
+
if (acct) {
|
|
11726
|
+
const n = acct[1].replace(/\s+/g, "").toUpperCase();
|
|
11727
|
+
return n.length >= 8 && n.length <= 34 ? `account:${n}` : null;
|
|
11728
|
+
}
|
|
11729
|
+
if (/^(email|host|iban):/i.test(v)) {
|
|
11730
|
+
const i = v.indexOf(":");
|
|
11731
|
+
const kind = v.slice(0, i).toLowerCase();
|
|
11732
|
+
const inner = normalizeRecipient(v.slice(i + 1));
|
|
11733
|
+
return inner && inner.startsWith(`${kind}:`) ? inner : null;
|
|
11734
|
+
}
|
|
11735
|
+
const found = extractArgDestinations({ to: v });
|
|
11736
|
+
return found.length === 1 ? found[0] : null;
|
|
11737
|
+
}
|
|
11738
|
+
function normalizeTrustedEntry(raw) {
|
|
11739
|
+
if (typeof raw !== "string") return null;
|
|
11740
|
+
const v = raw.trim().replace(/#sha256:([0-9A-Fa-f]{64})$/, (_m, h) => `#sha256:${h.toLowerCase()}`);
|
|
11741
|
+
if (v.includes("#")) return isHashedEntry(v) ? v : null;
|
|
11742
|
+
const full = normalizeRecipient(v);
|
|
11743
|
+
return full === null ? null : trustedEntryOf(full);
|
|
11744
|
+
}
|
|
11745
|
+
function entryDisplay(entry) {
|
|
11746
|
+
const i = entry.indexOf("#sha256:");
|
|
11747
|
+
return i > 0 ? entry.slice(0, i) : entry;
|
|
11748
|
+
}
|
|
11749
|
+
var IBAN_TEXT_RE = /\b[A-Z]{2}\d{2}(?:[ -]?[A-Z0-9]{4}){2,7}(?:[ -]?[A-Z0-9]{1,4})?\b/gi;
|
|
11750
|
+
var EMAIL_TEXT_RE = /[\p{L}\p{N}._%+-]+@[\p{L}\p{N}](?:[\p{L}\p{N}-]*[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]*[\p{L}\p{N}])?)*\.\p{L}{2,}/gu;
|
|
11751
|
+
var ACCOUNT_KEY_RE = /("(?:iban|account|account_number|accountNumber)"\s*:\s*")([A-Za-z0-9 .-]{6,40})(")/g;
|
|
11752
|
+
var ACCOUNT_VALUE_RE = /"([A-Z]{2}\d{2}[A-Z0-9]{11,30})"/g;
|
|
11753
|
+
function maskPersonalData(text) {
|
|
11754
|
+
if (!text) return text;
|
|
11755
|
+
try {
|
|
11756
|
+
let out = text;
|
|
11757
|
+
out = out.replace(IBAN_TEXT_RE, (m) => {
|
|
11758
|
+
const v = m.replace(/[ -]/g, "").toUpperCase();
|
|
11759
|
+
return validateIban(v) ? `${v.slice(0, 4)} **** **** ${v.slice(-4)}` : m;
|
|
11760
|
+
});
|
|
11761
|
+
out = replaceValidCards(out, (digits) => `**** **** **** ${digits.slice(-4)}`);
|
|
11762
|
+
out = out.replace(
|
|
11763
|
+
ACCOUNT_VALUE_RE,
|
|
11764
|
+
(m, v) => IBAN_LENGTH[v.slice(0, 2).toUpperCase()] === v.length ? `"****${v.slice(-4)}"` : m
|
|
11765
|
+
);
|
|
11766
|
+
out = out.replace(ACCOUNT_KEY_RE, (m, a, v, b) => {
|
|
11767
|
+
const compact = v.replace(/[ .-]/g, "");
|
|
11768
|
+
const digits = compact.replace(/\D/g, "").length;
|
|
11769
|
+
return digits >= 6 && digits * 2 >= compact.length ? `${a}****${compact.slice(-4)}${b}` : m;
|
|
11770
|
+
});
|
|
11771
|
+
if (out.includes("@")) out = out.replace(EMAIL_TEXT_RE, (m) => maskEmailValue(m));
|
|
11772
|
+
return out;
|
|
11773
|
+
} catch {
|
|
11774
|
+
return text;
|
|
11775
|
+
}
|
|
11776
|
+
}
|
|
11777
|
+
var MAX_MASK_DEPTH = 64;
|
|
11778
|
+
function maskPersonalValue(value) {
|
|
11779
|
+
return maskLeaf(value, "", 0);
|
|
11780
|
+
}
|
|
11781
|
+
function maskLeaf(value, key, depth) {
|
|
11782
|
+
if (depth > MAX_MASK_DEPTH) return "[REDACTED]";
|
|
11783
|
+
if (typeof value === "string") {
|
|
11784
|
+
try {
|
|
11785
|
+
const json = `{${JSON.stringify(key)}:${JSON.stringify(value)}}`;
|
|
11786
|
+
return Object.values(JSON.parse(maskPersonalData(json)))[0];
|
|
11787
|
+
} catch {
|
|
11788
|
+
return "[REDACTED]";
|
|
11789
|
+
}
|
|
11790
|
+
}
|
|
11791
|
+
if (typeof value === "number") {
|
|
11792
|
+
const text = String(value);
|
|
11793
|
+
const masked = maskPersonalData(text);
|
|
11794
|
+
return masked === text ? value : masked;
|
|
11795
|
+
}
|
|
11796
|
+
if (Array.isArray(value)) return value.map((v) => maskLeaf(v, key, depth + 1));
|
|
11797
|
+
if (value && typeof value === "object") {
|
|
11798
|
+
return Object.fromEntries(
|
|
11799
|
+
Object.entries(value).map(([k, v]) => [maskPersonalData(k), maskLeaf(v, k, depth + 1)])
|
|
11800
|
+
);
|
|
11801
|
+
}
|
|
11802
|
+
return value;
|
|
11803
|
+
}
|
|
11804
|
+
|
|
11534
11805
|
// src/exposure/shell.ts
|
|
11535
11806
|
var import_mvdan_sh4 = __toESM(require("mvdan-sh"));
|
|
11536
11807
|
var { syntax: syntax4 } = import_mvdan_sh4.default;
|
|
@@ -12011,11 +12282,11 @@ function safeMessage(value, max = 300) {
|
|
|
12011
12282
|
}
|
|
12012
12283
|
|
|
12013
12284
|
// src/loop/index.ts
|
|
12014
|
-
var
|
|
12285
|
+
var import_crypto3 = __toESM(require("crypto"));
|
|
12015
12286
|
var LOOP_MAX_RECORDS = 500;
|
|
12016
12287
|
function computeArgsHash(args) {
|
|
12017
12288
|
const str = JSON.stringify(args ?? "");
|
|
12018
|
-
return
|
|
12289
|
+
return import_crypto3.default.createHash("sha256").update(str).digest("hex").slice(0, 16);
|
|
12019
12290
|
}
|
|
12020
12291
|
function evaluateLoopWindow(records, tool, args, threshold, windowMs, now) {
|
|
12021
12292
|
const hash2 = computeArgsHash(args);
|
|
@@ -12310,88 +12581,6 @@ var FILE_TOOLS = /* @__PURE__ */ new Set([
|
|
|
12310
12581
|
"list_files"
|
|
12311
12582
|
]);
|
|
12312
12583
|
|
|
12313
|
-
// src/scan/pii.ts
|
|
12314
|
-
var PII_EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/;
|
|
12315
|
-
var PII_SSN_RE = /\b\d{3}-\d{2}-\d{4}\b/;
|
|
12316
|
-
var PII_PHONE_RE = /\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]\d{3}[-.\s]\d{4}\b/;
|
|
12317
|
-
var PII_CC16_RE = /\b(?:4\d{3}|5[1-5]\d{2}|6\d{3})[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/;
|
|
12318
|
-
var PII_CC15_RE = /\b3[47]\d{2}[-\s]?\d{6}[-\s]?\d{5}\b/;
|
|
12319
|
-
var PII_IBAN_RE = /\b[A-Z]{2}\d{2}(?:[A-Z0-9]|[ -][A-Z0-9]){11,30}\b/;
|
|
12320
|
-
function hasValidCard(text) {
|
|
12321
|
-
for (const base2 of [PII_CC16_RE, PII_CC15_RE]) {
|
|
12322
|
-
const re = new RegExp(base2.source, "g");
|
|
12323
|
-
let m;
|
|
12324
|
-
while ((m = re.exec(text)) !== null) {
|
|
12325
|
-
const digits = m[0].replace(/\D/g, "");
|
|
12326
|
-
if (!isDecimalFraction(text, m.index, digits.length === m[0].length)) {
|
|
12327
|
-
if (validateLuhn(digits)) return true;
|
|
12328
|
-
}
|
|
12329
|
-
re.lastIndex = m.index + 1;
|
|
12330
|
-
}
|
|
12331
|
-
}
|
|
12332
|
-
return false;
|
|
12333
|
-
}
|
|
12334
|
-
function isDecimalFraction(text, index, unseparated) {
|
|
12335
|
-
if (!unseparated || text[index - 1] !== ".") return false;
|
|
12336
|
-
const before = text.charCodeAt(index - 2);
|
|
12337
|
-
return before >= 48 && before <= 57;
|
|
12338
|
-
}
|
|
12339
|
-
function hasValidIban(text) {
|
|
12340
|
-
const re = new RegExp(PII_IBAN_RE.source, "g");
|
|
12341
|
-
let m;
|
|
12342
|
-
while ((m = re.exec(text)) !== null) {
|
|
12343
|
-
if (validateIban(m[0])) return true;
|
|
12344
|
-
re.lastIndex = m.index + 1;
|
|
12345
|
-
}
|
|
12346
|
-
return false;
|
|
12347
|
-
}
|
|
12348
|
-
function detectPii(text) {
|
|
12349
|
-
const found = /* @__PURE__ */ new Set();
|
|
12350
|
-
if (/@/.test(text) && PII_EMAIL_RE.test(text)) found.add("Email");
|
|
12351
|
-
if (/-/.test(text) && PII_SSN_RE.test(text)) found.add("SSN");
|
|
12352
|
-
if (PII_PHONE_RE.test(text)) found.add("Phone");
|
|
12353
|
-
if (hasValidCard(text)) found.add("Credit Card");
|
|
12354
|
-
if (hasValidIban(text)) found.add("IBAN");
|
|
12355
|
-
return [...found];
|
|
12356
|
-
}
|
|
12357
|
-
var REALTIME_PII_PATTERNS = ["SSN", "Credit Card", "IBAN"];
|
|
12358
|
-
var MAX_PII_SCAN_BYTES = 1e5;
|
|
12359
|
-
function* stringLeaves(v, depth = 0) {
|
|
12360
|
-
if (depth > 6) return;
|
|
12361
|
-
if (typeof v === "string") {
|
|
12362
|
-
if (v.length > 0) yield v;
|
|
12363
|
-
return;
|
|
12364
|
-
}
|
|
12365
|
-
if (typeof v === "number") {
|
|
12366
|
-
if (Number.isFinite(v)) yield String(v);
|
|
12367
|
-
return;
|
|
12368
|
-
}
|
|
12369
|
-
if (!v || typeof v !== "object") return;
|
|
12370
|
-
if (Array.isArray(v)) {
|
|
12371
|
-
for (const x of v) yield* stringLeaves(x, depth + 1);
|
|
12372
|
-
return;
|
|
12373
|
-
}
|
|
12374
|
-
for (const x of Object.values(v)) yield* stringLeaves(x, depth + 1);
|
|
12375
|
-
}
|
|
12376
|
-
function detectArgsPii(args) {
|
|
12377
|
-
if (args === null || args === void 0) return [];
|
|
12378
|
-
const found = /* @__PURE__ */ new Set();
|
|
12379
|
-
let budget = MAX_PII_SCAN_BYTES;
|
|
12380
|
-
try {
|
|
12381
|
-
for (const leaf of stringLeaves(args)) {
|
|
12382
|
-
if (budget <= 0) break;
|
|
12383
|
-
const t = leaf.length > budget ? leaf.slice(0, budget) : leaf;
|
|
12384
|
-
budget -= t.length;
|
|
12385
|
-
for (const p of detectPii(t)) {
|
|
12386
|
-
if (REALTIME_PII_PATTERNS.includes(p)) found.add(p);
|
|
12387
|
-
}
|
|
12388
|
-
}
|
|
12389
|
-
} catch {
|
|
12390
|
-
return [];
|
|
12391
|
-
}
|
|
12392
|
-
return [...found];
|
|
12393
|
-
}
|
|
12394
|
-
|
|
12395
12584
|
// src/dlp/canary.ts
|
|
12396
12585
|
var CANARY_MIN_LENGTH = 16;
|
|
12397
12586
|
var MAX_TEXT = 1e5;
|
|
@@ -12563,8 +12752,8 @@ function matchCanaryArgs(args, values) {
|
|
|
12563
12752
|
|
|
12564
12753
|
// src/scan/canonical.ts
|
|
12565
12754
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
12566
|
-
var CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
12567
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
12755
|
+
var CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
|
|
12756
|
+
var CANONICAL_EXTRACTOR_HASH = "a358f47eacca6e14";
|
|
12568
12757
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
12569
12758
|
function extractCanonicalFindings(call, ctx) {
|
|
12570
12759
|
const out = [];
|
|
@@ -13016,6 +13205,7 @@ var ENGINE_VERSION = "1.4.0";
|
|
|
13016
13205
|
detectDangerousShellExec,
|
|
13017
13206
|
detectInlineExec,
|
|
13018
13207
|
detectPii,
|
|
13208
|
+
entryDisplay,
|
|
13019
13209
|
evaluateEgress,
|
|
13020
13210
|
evaluateLoopWindow,
|
|
13021
13211
|
evaluatePolicy,
|
|
@@ -13039,6 +13229,7 @@ var ENGINE_VERSION = "1.4.0";
|
|
|
13039
13229
|
getCompiledRegex,
|
|
13040
13230
|
getNestedValue,
|
|
13041
13231
|
gitRepoPath,
|
|
13232
|
+
hashDestination,
|
|
13042
13233
|
hostMatches,
|
|
13043
13234
|
incompleteFileVerdict,
|
|
13044
13235
|
inspectArgumentSecrets,
|
|
@@ -13047,12 +13238,14 @@ var ENGINE_VERSION = "1.4.0";
|
|
|
13047
13238
|
isAgentInstructionPath,
|
|
13048
13239
|
isBashTool,
|
|
13049
13240
|
isDestructiveToolName,
|
|
13241
|
+
isHashedEntry,
|
|
13050
13242
|
isIgnoredTool,
|
|
13051
13243
|
isInside,
|
|
13052
13244
|
isKnobGoverned,
|
|
13053
13245
|
isLegacySystemPath,
|
|
13054
13246
|
isLockedCheck,
|
|
13055
13247
|
isLoopbackHost,
|
|
13248
|
+
isMaskedKind,
|
|
13056
13249
|
isPasswordHashPath,
|
|
13057
13250
|
isPrivateHost,
|
|
13058
13251
|
isProtectedHomePath,
|
|
@@ -13060,16 +13253,24 @@ var ENGINE_VERSION = "1.4.0";
|
|
|
13060
13253
|
isShieldVerdict,
|
|
13061
13254
|
isStrictGatedTier,
|
|
13062
13255
|
isVerdict,
|
|
13256
|
+
maskDestination,
|
|
13257
|
+
maskPersonalData,
|
|
13258
|
+
maskPersonalValue,
|
|
13063
13259
|
matchCanary,
|
|
13064
13260
|
matchCanaryArgs,
|
|
13065
13261
|
matchSensitivePath,
|
|
13066
13262
|
matchesPattern,
|
|
13263
|
+
matchesTrustedEntry,
|
|
13264
|
+
matchesTrustedList,
|
|
13067
13265
|
narrativeRuleLabel,
|
|
13068
13266
|
normalizeCommandForPolicy,
|
|
13267
|
+
normalizeDestination,
|
|
13069
13268
|
normalizeFilePath,
|
|
13070
13269
|
normalizeForScan,
|
|
13071
13270
|
normalizeIpLiteral,
|
|
13072
13271
|
normalizePyPiName,
|
|
13272
|
+
normalizeRecipient,
|
|
13273
|
+
normalizeTrustedEntry,
|
|
13073
13274
|
parseAllSshHostsFromCommand,
|
|
13074
13275
|
parseDestHost,
|
|
13075
13276
|
patternShapeOf,
|
|
@@ -13103,6 +13304,7 @@ var ENGINE_VERSION = "1.4.0";
|
|
|
13103
13304
|
toScanFinding,
|
|
13104
13305
|
toolMatchesRule,
|
|
13105
13306
|
truncateBlastPath,
|
|
13307
|
+
trustedEntryOf,
|
|
13106
13308
|
tuningFromLegacyPolicy,
|
|
13107
13309
|
tuningToLegacyPolicy,
|
|
13108
13310
|
unwrapCommandHead,
|
package/dist/index.mjs
CHANGED
|
@@ -11322,6 +11322,264 @@ function isDestructiveToolName(bareTool) {
|
|
|
11322
11322
|
return DESTRUCTIVE_VERB_RE.test(bareTool);
|
|
11323
11323
|
}
|
|
11324
11324
|
|
|
11325
|
+
// src/exposure/mask.ts
|
|
11326
|
+
import { createHash as createHash3 } from "crypto";
|
|
11327
|
+
|
|
11328
|
+
// src/scan/pii.ts
|
|
11329
|
+
var PII_EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/;
|
|
11330
|
+
var PII_SSN_RE = /\b\d{3}-\d{2}-\d{4}\b/;
|
|
11331
|
+
var PII_PHONE_RE = /\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]\d{3}[-.\s]\d{4}\b/;
|
|
11332
|
+
var PII_CC16_RE = /\b(?:4\d{3}|5[1-5]\d{2}|6\d{3})[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/;
|
|
11333
|
+
var PII_CC15_RE = /\b3[47]\d{2}[-\s]?\d{6}[-\s]?\d{5}\b/;
|
|
11334
|
+
var PII_IBAN_RE = /\b[A-Z]{2}\d{2}(?:[A-Z0-9]|[ -][A-Z0-9]){11,30}\b/;
|
|
11335
|
+
function* validCardRuns(text, base2) {
|
|
11336
|
+
const re = new RegExp(base2.source, "g");
|
|
11337
|
+
let m;
|
|
11338
|
+
while ((m = re.exec(text)) !== null) {
|
|
11339
|
+
const digits = m[0].replace(/\D/g, "");
|
|
11340
|
+
if (!isDecimalFraction(text, m.index, digits.length === m[0].length) && validateLuhn(digits)) {
|
|
11341
|
+
yield { index: m.index, length: m[0].length, digits };
|
|
11342
|
+
} else {
|
|
11343
|
+
re.lastIndex = m.index + 1;
|
|
11344
|
+
}
|
|
11345
|
+
}
|
|
11346
|
+
}
|
|
11347
|
+
function hasValidCard(text) {
|
|
11348
|
+
for (const base2 of [PII_CC16_RE, PII_CC15_RE]) {
|
|
11349
|
+
if (!validCardRuns(text, base2).next().done) return true;
|
|
11350
|
+
}
|
|
11351
|
+
return false;
|
|
11352
|
+
}
|
|
11353
|
+
function replaceValidCards(text, replace) {
|
|
11354
|
+
let out = text;
|
|
11355
|
+
for (const base2 of [PII_CC16_RE, PII_CC15_RE]) {
|
|
11356
|
+
let res = "";
|
|
11357
|
+
let last = 0;
|
|
11358
|
+
for (const run of validCardRuns(out, base2)) {
|
|
11359
|
+
res += out.slice(last, run.index) + replace(run.digits);
|
|
11360
|
+
last = run.index + run.length;
|
|
11361
|
+
}
|
|
11362
|
+
out = res + out.slice(last);
|
|
11363
|
+
}
|
|
11364
|
+
return out;
|
|
11365
|
+
}
|
|
11366
|
+
var NUMBER_LEAD_RE = /[\s:=;([{"'+-]/;
|
|
11367
|
+
function isDecimalFraction(text, index, unseparated) {
|
|
11368
|
+
if (!unseparated) return false;
|
|
11369
|
+
const sep = text[index - 1];
|
|
11370
|
+
const a = text[index - 2];
|
|
11371
|
+
if (sep === ".") {
|
|
11372
|
+
if (a !== void 0 && a >= "0" && a <= "9") return true;
|
|
11373
|
+
return a === void 0 || NUMBER_LEAD_RE.test(a);
|
|
11374
|
+
}
|
|
11375
|
+
if (sep === "," && a === "0") {
|
|
11376
|
+
const b = text[index - 3];
|
|
11377
|
+
return b === void 0 || NUMBER_LEAD_RE.test(b);
|
|
11378
|
+
}
|
|
11379
|
+
return false;
|
|
11380
|
+
}
|
|
11381
|
+
function hasValidIban(text) {
|
|
11382
|
+
const re = new RegExp(PII_IBAN_RE.source, "g");
|
|
11383
|
+
let m;
|
|
11384
|
+
while ((m = re.exec(text)) !== null) {
|
|
11385
|
+
if (validateIban(m[0])) return true;
|
|
11386
|
+
re.lastIndex = m.index + 1;
|
|
11387
|
+
}
|
|
11388
|
+
return false;
|
|
11389
|
+
}
|
|
11390
|
+
function detectPii(text) {
|
|
11391
|
+
const found = /* @__PURE__ */ new Set();
|
|
11392
|
+
if (/@/.test(text) && PII_EMAIL_RE.test(text)) found.add("Email");
|
|
11393
|
+
if (/-/.test(text) && PII_SSN_RE.test(text)) found.add("SSN");
|
|
11394
|
+
if (PII_PHONE_RE.test(text)) found.add("Phone");
|
|
11395
|
+
if (hasValidCard(text)) found.add("Credit Card");
|
|
11396
|
+
if (hasValidIban(text)) found.add("IBAN");
|
|
11397
|
+
return [...found];
|
|
11398
|
+
}
|
|
11399
|
+
var REALTIME_PII_PATTERNS = ["SSN", "Credit Card", "IBAN"];
|
|
11400
|
+
var MAX_PII_SCAN_BYTES = 1e5;
|
|
11401
|
+
function* stringLeaves(v, depth = 0) {
|
|
11402
|
+
if (depth > 6) return;
|
|
11403
|
+
if (typeof v === "string") {
|
|
11404
|
+
if (v.length > 0) yield v;
|
|
11405
|
+
return;
|
|
11406
|
+
}
|
|
11407
|
+
if (typeof v === "number") {
|
|
11408
|
+
if (Number.isFinite(v)) yield String(v);
|
|
11409
|
+
return;
|
|
11410
|
+
}
|
|
11411
|
+
if (!v || typeof v !== "object") return;
|
|
11412
|
+
if (Array.isArray(v)) {
|
|
11413
|
+
for (const x of v) yield* stringLeaves(x, depth + 1);
|
|
11414
|
+
return;
|
|
11415
|
+
}
|
|
11416
|
+
for (const x of Object.values(v)) yield* stringLeaves(x, depth + 1);
|
|
11417
|
+
}
|
|
11418
|
+
function detectArgsPii(args) {
|
|
11419
|
+
if (args === null || args === void 0) return [];
|
|
11420
|
+
const found = /* @__PURE__ */ new Set();
|
|
11421
|
+
let budget = MAX_PII_SCAN_BYTES;
|
|
11422
|
+
try {
|
|
11423
|
+
for (const leaf of stringLeaves(args)) {
|
|
11424
|
+
if (budget <= 0) break;
|
|
11425
|
+
const t = leaf.length > budget ? leaf.slice(0, budget) : leaf;
|
|
11426
|
+
budget -= t.length;
|
|
11427
|
+
for (const p of detectPii(t)) {
|
|
11428
|
+
if (REALTIME_PII_PATTERNS.includes(p)) found.add(p);
|
|
11429
|
+
}
|
|
11430
|
+
}
|
|
11431
|
+
} catch {
|
|
11432
|
+
return [];
|
|
11433
|
+
}
|
|
11434
|
+
return [...found];
|
|
11435
|
+
}
|
|
11436
|
+
|
|
11437
|
+
// src/exposure/mask.ts
|
|
11438
|
+
var MASKED_KINDS = /* @__PURE__ */ new Set(["email", "iban", "account"]);
|
|
11439
|
+
var ENTRY_RE = /^(email|iban|account):([^#\s]{1,200}(?: [^#\s]{1,40}){0,4})#sha256:([0-9a-f]{64})$/;
|
|
11440
|
+
function split(dest) {
|
|
11441
|
+
const i = dest.indexOf(":");
|
|
11442
|
+
if (i <= 0) return null;
|
|
11443
|
+
return { kind: dest.slice(0, i).toLowerCase(), value: dest.slice(i + 1) };
|
|
11444
|
+
}
|
|
11445
|
+
function normalizeDestination(dest) {
|
|
11446
|
+
const p = split(dest.trim());
|
|
11447
|
+
if (!p) return dest.trim();
|
|
11448
|
+
if (p.kind === "iban" || p.kind === "account")
|
|
11449
|
+
return `${p.kind}:${p.value.replace(/\s+/g, "").toUpperCase()}`;
|
|
11450
|
+
return `${p.kind}:${p.value.toLowerCase()}`;
|
|
11451
|
+
}
|
|
11452
|
+
function maskEmailValue(address) {
|
|
11453
|
+
const at = address.lastIndexOf("@");
|
|
11454
|
+
if (at <= 0) return "***";
|
|
11455
|
+
return `${address[0]}***@${address.slice(at + 1)}`;
|
|
11456
|
+
}
|
|
11457
|
+
function maskDestination(dest) {
|
|
11458
|
+
const n = normalizeDestination(dest);
|
|
11459
|
+
const p = split(n);
|
|
11460
|
+
if (!p || !MASKED_KINDS.has(p.kind)) return n;
|
|
11461
|
+
if (p.kind === "iban") return `iban:${p.value.slice(0, 4)} **** **** ${p.value.slice(-4)}`;
|
|
11462
|
+
if (p.kind === "account") return `account:****${p.value.slice(-4)}`;
|
|
11463
|
+
return `email:${maskEmailValue(p.value)}`;
|
|
11464
|
+
}
|
|
11465
|
+
function isMaskedKind(dest) {
|
|
11466
|
+
const p = split(dest);
|
|
11467
|
+
return !!p && MASKED_KINDS.has(p.kind);
|
|
11468
|
+
}
|
|
11469
|
+
function hashDestination(dest) {
|
|
11470
|
+
return createHash3("sha256").update(normalizeDestination(dest), "utf8").digest("hex");
|
|
11471
|
+
}
|
|
11472
|
+
function isHashedEntry(entry) {
|
|
11473
|
+
return ENTRY_RE.test(entry);
|
|
11474
|
+
}
|
|
11475
|
+
function trustedEntryOf(dest) {
|
|
11476
|
+
const n = normalizeDestination(dest);
|
|
11477
|
+
if (!isMaskedKind(n)) return n;
|
|
11478
|
+
return `${maskDestination(n)}#sha256:${hashDestination(n)}`;
|
|
11479
|
+
}
|
|
11480
|
+
function matchesTrustedEntry(dest, entry) {
|
|
11481
|
+
const m = ENTRY_RE.exec(entry);
|
|
11482
|
+
if (m) return hashDestination(dest) === m[3];
|
|
11483
|
+
return normalizeDestination(dest) === normalizeDestination(entry);
|
|
11484
|
+
}
|
|
11485
|
+
function matchesTrustedList(dest, entries) {
|
|
11486
|
+
if (entries.length === 0) return false;
|
|
11487
|
+
const plain = normalizeDestination(dest);
|
|
11488
|
+
let hash2;
|
|
11489
|
+
for (const entry of entries) {
|
|
11490
|
+
const m = ENTRY_RE.exec(entry);
|
|
11491
|
+
if (m) {
|
|
11492
|
+
hash2 ??= hashDestination(dest);
|
|
11493
|
+
if (hash2 === m[3]) return true;
|
|
11494
|
+
} else if (plain === normalizeDestination(entry)) return true;
|
|
11495
|
+
}
|
|
11496
|
+
return false;
|
|
11497
|
+
}
|
|
11498
|
+
function normalizeRecipient(raw) {
|
|
11499
|
+
if (typeof raw !== "string") return null;
|
|
11500
|
+
const v = raw.trim();
|
|
11501
|
+
if (!v || v.length > 512) return null;
|
|
11502
|
+
const acct = /^account:([A-Za-z0-9 ]{8,40})$/i.exec(v);
|
|
11503
|
+
if (acct) {
|
|
11504
|
+
const n = acct[1].replace(/\s+/g, "").toUpperCase();
|
|
11505
|
+
return n.length >= 8 && n.length <= 34 ? `account:${n}` : null;
|
|
11506
|
+
}
|
|
11507
|
+
if (/^(email|host|iban):/i.test(v)) {
|
|
11508
|
+
const i = v.indexOf(":");
|
|
11509
|
+
const kind = v.slice(0, i).toLowerCase();
|
|
11510
|
+
const inner = normalizeRecipient(v.slice(i + 1));
|
|
11511
|
+
return inner && inner.startsWith(`${kind}:`) ? inner : null;
|
|
11512
|
+
}
|
|
11513
|
+
const found = extractArgDestinations({ to: v });
|
|
11514
|
+
return found.length === 1 ? found[0] : null;
|
|
11515
|
+
}
|
|
11516
|
+
function normalizeTrustedEntry(raw) {
|
|
11517
|
+
if (typeof raw !== "string") return null;
|
|
11518
|
+
const v = raw.trim().replace(/#sha256:([0-9A-Fa-f]{64})$/, (_m, h) => `#sha256:${h.toLowerCase()}`);
|
|
11519
|
+
if (v.includes("#")) return isHashedEntry(v) ? v : null;
|
|
11520
|
+
const full = normalizeRecipient(v);
|
|
11521
|
+
return full === null ? null : trustedEntryOf(full);
|
|
11522
|
+
}
|
|
11523
|
+
function entryDisplay(entry) {
|
|
11524
|
+
const i = entry.indexOf("#sha256:");
|
|
11525
|
+
return i > 0 ? entry.slice(0, i) : entry;
|
|
11526
|
+
}
|
|
11527
|
+
var IBAN_TEXT_RE = /\b[A-Z]{2}\d{2}(?:[ -]?[A-Z0-9]{4}){2,7}(?:[ -]?[A-Z0-9]{1,4})?\b/gi;
|
|
11528
|
+
var EMAIL_TEXT_RE = /[\p{L}\p{N}._%+-]+@[\p{L}\p{N}](?:[\p{L}\p{N}-]*[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]*[\p{L}\p{N}])?)*\.\p{L}{2,}/gu;
|
|
11529
|
+
var ACCOUNT_KEY_RE = /("(?:iban|account|account_number|accountNumber)"\s*:\s*")([A-Za-z0-9 .-]{6,40})(")/g;
|
|
11530
|
+
var ACCOUNT_VALUE_RE = /"([A-Z]{2}\d{2}[A-Z0-9]{11,30})"/g;
|
|
11531
|
+
function maskPersonalData(text) {
|
|
11532
|
+
if (!text) return text;
|
|
11533
|
+
try {
|
|
11534
|
+
let out = text;
|
|
11535
|
+
out = out.replace(IBAN_TEXT_RE, (m) => {
|
|
11536
|
+
const v = m.replace(/[ -]/g, "").toUpperCase();
|
|
11537
|
+
return validateIban(v) ? `${v.slice(0, 4)} **** **** ${v.slice(-4)}` : m;
|
|
11538
|
+
});
|
|
11539
|
+
out = replaceValidCards(out, (digits) => `**** **** **** ${digits.slice(-4)}`);
|
|
11540
|
+
out = out.replace(
|
|
11541
|
+
ACCOUNT_VALUE_RE,
|
|
11542
|
+
(m, v) => IBAN_LENGTH[v.slice(0, 2).toUpperCase()] === v.length ? `"****${v.slice(-4)}"` : m
|
|
11543
|
+
);
|
|
11544
|
+
out = out.replace(ACCOUNT_KEY_RE, (m, a, v, b) => {
|
|
11545
|
+
const compact = v.replace(/[ .-]/g, "");
|
|
11546
|
+
const digits = compact.replace(/\D/g, "").length;
|
|
11547
|
+
return digits >= 6 && digits * 2 >= compact.length ? `${a}****${compact.slice(-4)}${b}` : m;
|
|
11548
|
+
});
|
|
11549
|
+
if (out.includes("@")) out = out.replace(EMAIL_TEXT_RE, (m) => maskEmailValue(m));
|
|
11550
|
+
return out;
|
|
11551
|
+
} catch {
|
|
11552
|
+
return text;
|
|
11553
|
+
}
|
|
11554
|
+
}
|
|
11555
|
+
var MAX_MASK_DEPTH = 64;
|
|
11556
|
+
function maskPersonalValue(value) {
|
|
11557
|
+
return maskLeaf(value, "", 0);
|
|
11558
|
+
}
|
|
11559
|
+
function maskLeaf(value, key, depth) {
|
|
11560
|
+
if (depth > MAX_MASK_DEPTH) return "[REDACTED]";
|
|
11561
|
+
if (typeof value === "string") {
|
|
11562
|
+
try {
|
|
11563
|
+
const json = `{${JSON.stringify(key)}:${JSON.stringify(value)}}`;
|
|
11564
|
+
return Object.values(JSON.parse(maskPersonalData(json)))[0];
|
|
11565
|
+
} catch {
|
|
11566
|
+
return "[REDACTED]";
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
if (typeof value === "number") {
|
|
11570
|
+
const text = String(value);
|
|
11571
|
+
const masked = maskPersonalData(text);
|
|
11572
|
+
return masked === text ? value : masked;
|
|
11573
|
+
}
|
|
11574
|
+
if (Array.isArray(value)) return value.map((v) => maskLeaf(v, key, depth + 1));
|
|
11575
|
+
if (value && typeof value === "object") {
|
|
11576
|
+
return Object.fromEntries(
|
|
11577
|
+
Object.entries(value).map(([k, v]) => [maskPersonalData(k), maskLeaf(v, k, depth + 1)])
|
|
11578
|
+
);
|
|
11579
|
+
}
|
|
11580
|
+
return value;
|
|
11581
|
+
}
|
|
11582
|
+
|
|
11325
11583
|
// src/exposure/shell.ts
|
|
11326
11584
|
import mvdanSh4 from "mvdan-sh";
|
|
11327
11585
|
var { syntax: syntax4 } = mvdanSh4;
|
|
@@ -12101,88 +12359,6 @@ var FILE_TOOLS = /* @__PURE__ */ new Set([
|
|
|
12101
12359
|
"list_files"
|
|
12102
12360
|
]);
|
|
12103
12361
|
|
|
12104
|
-
// src/scan/pii.ts
|
|
12105
|
-
var PII_EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/;
|
|
12106
|
-
var PII_SSN_RE = /\b\d{3}-\d{2}-\d{4}\b/;
|
|
12107
|
-
var PII_PHONE_RE = /\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]\d{3}[-.\s]\d{4}\b/;
|
|
12108
|
-
var PII_CC16_RE = /\b(?:4\d{3}|5[1-5]\d{2}|6\d{3})[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/;
|
|
12109
|
-
var PII_CC15_RE = /\b3[47]\d{2}[-\s]?\d{6}[-\s]?\d{5}\b/;
|
|
12110
|
-
var PII_IBAN_RE = /\b[A-Z]{2}\d{2}(?:[A-Z0-9]|[ -][A-Z0-9]){11,30}\b/;
|
|
12111
|
-
function hasValidCard(text) {
|
|
12112
|
-
for (const base2 of [PII_CC16_RE, PII_CC15_RE]) {
|
|
12113
|
-
const re = new RegExp(base2.source, "g");
|
|
12114
|
-
let m;
|
|
12115
|
-
while ((m = re.exec(text)) !== null) {
|
|
12116
|
-
const digits = m[0].replace(/\D/g, "");
|
|
12117
|
-
if (!isDecimalFraction(text, m.index, digits.length === m[0].length)) {
|
|
12118
|
-
if (validateLuhn(digits)) return true;
|
|
12119
|
-
}
|
|
12120
|
-
re.lastIndex = m.index + 1;
|
|
12121
|
-
}
|
|
12122
|
-
}
|
|
12123
|
-
return false;
|
|
12124
|
-
}
|
|
12125
|
-
function isDecimalFraction(text, index, unseparated) {
|
|
12126
|
-
if (!unseparated || text[index - 1] !== ".") return false;
|
|
12127
|
-
const before = text.charCodeAt(index - 2);
|
|
12128
|
-
return before >= 48 && before <= 57;
|
|
12129
|
-
}
|
|
12130
|
-
function hasValidIban(text) {
|
|
12131
|
-
const re = new RegExp(PII_IBAN_RE.source, "g");
|
|
12132
|
-
let m;
|
|
12133
|
-
while ((m = re.exec(text)) !== null) {
|
|
12134
|
-
if (validateIban(m[0])) return true;
|
|
12135
|
-
re.lastIndex = m.index + 1;
|
|
12136
|
-
}
|
|
12137
|
-
return false;
|
|
12138
|
-
}
|
|
12139
|
-
function detectPii(text) {
|
|
12140
|
-
const found = /* @__PURE__ */ new Set();
|
|
12141
|
-
if (/@/.test(text) && PII_EMAIL_RE.test(text)) found.add("Email");
|
|
12142
|
-
if (/-/.test(text) && PII_SSN_RE.test(text)) found.add("SSN");
|
|
12143
|
-
if (PII_PHONE_RE.test(text)) found.add("Phone");
|
|
12144
|
-
if (hasValidCard(text)) found.add("Credit Card");
|
|
12145
|
-
if (hasValidIban(text)) found.add("IBAN");
|
|
12146
|
-
return [...found];
|
|
12147
|
-
}
|
|
12148
|
-
var REALTIME_PII_PATTERNS = ["SSN", "Credit Card", "IBAN"];
|
|
12149
|
-
var MAX_PII_SCAN_BYTES = 1e5;
|
|
12150
|
-
function* stringLeaves(v, depth = 0) {
|
|
12151
|
-
if (depth > 6) return;
|
|
12152
|
-
if (typeof v === "string") {
|
|
12153
|
-
if (v.length > 0) yield v;
|
|
12154
|
-
return;
|
|
12155
|
-
}
|
|
12156
|
-
if (typeof v === "number") {
|
|
12157
|
-
if (Number.isFinite(v)) yield String(v);
|
|
12158
|
-
return;
|
|
12159
|
-
}
|
|
12160
|
-
if (!v || typeof v !== "object") return;
|
|
12161
|
-
if (Array.isArray(v)) {
|
|
12162
|
-
for (const x of v) yield* stringLeaves(x, depth + 1);
|
|
12163
|
-
return;
|
|
12164
|
-
}
|
|
12165
|
-
for (const x of Object.values(v)) yield* stringLeaves(x, depth + 1);
|
|
12166
|
-
}
|
|
12167
|
-
function detectArgsPii(args) {
|
|
12168
|
-
if (args === null || args === void 0) return [];
|
|
12169
|
-
const found = /* @__PURE__ */ new Set();
|
|
12170
|
-
let budget = MAX_PII_SCAN_BYTES;
|
|
12171
|
-
try {
|
|
12172
|
-
for (const leaf of stringLeaves(args)) {
|
|
12173
|
-
if (budget <= 0) break;
|
|
12174
|
-
const t = leaf.length > budget ? leaf.slice(0, budget) : leaf;
|
|
12175
|
-
budget -= t.length;
|
|
12176
|
-
for (const p of detectPii(t)) {
|
|
12177
|
-
if (REALTIME_PII_PATTERNS.includes(p)) found.add(p);
|
|
12178
|
-
}
|
|
12179
|
-
}
|
|
12180
|
-
} catch {
|
|
12181
|
-
return [];
|
|
12182
|
-
}
|
|
12183
|
-
return [...found];
|
|
12184
|
-
}
|
|
12185
|
-
|
|
12186
12362
|
// src/dlp/canary.ts
|
|
12187
12363
|
var CANARY_MIN_LENGTH = 16;
|
|
12188
12364
|
var MAX_TEXT = 1e5;
|
|
@@ -12354,8 +12530,8 @@ function matchCanaryArgs(args, values) {
|
|
|
12354
12530
|
|
|
12355
12531
|
// src/scan/canonical.ts
|
|
12356
12532
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
12357
|
-
var CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
12358
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
12533
|
+
var CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
|
|
12534
|
+
var CANONICAL_EXTRACTOR_HASH = "a358f47eacca6e14";
|
|
12359
12535
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
12360
12536
|
function extractCanonicalFindings(call, ctx) {
|
|
12361
12537
|
const out = [];
|
|
@@ -12806,6 +12982,7 @@ export {
|
|
|
12806
12982
|
detectDangerousShellExec,
|
|
12807
12983
|
detectInlineExec,
|
|
12808
12984
|
detectPii,
|
|
12985
|
+
entryDisplay,
|
|
12809
12986
|
evaluateEgress,
|
|
12810
12987
|
evaluateLoopWindow,
|
|
12811
12988
|
evaluatePolicy,
|
|
@@ -12829,6 +13006,7 @@ export {
|
|
|
12829
13006
|
getCompiledRegex,
|
|
12830
13007
|
getNestedValue,
|
|
12831
13008
|
gitRepoPath,
|
|
13009
|
+
hashDestination,
|
|
12832
13010
|
hostMatches,
|
|
12833
13011
|
incompleteFileVerdict,
|
|
12834
13012
|
inspectArgumentSecrets,
|
|
@@ -12837,12 +13015,14 @@ export {
|
|
|
12837
13015
|
isAgentInstructionPath,
|
|
12838
13016
|
isBashTool,
|
|
12839
13017
|
isDestructiveToolName,
|
|
13018
|
+
isHashedEntry,
|
|
12840
13019
|
isIgnoredTool,
|
|
12841
13020
|
isInside,
|
|
12842
13021
|
isKnobGoverned,
|
|
12843
13022
|
isLegacySystemPath,
|
|
12844
13023
|
isLockedCheck,
|
|
12845
13024
|
isLoopbackHost,
|
|
13025
|
+
isMaskedKind,
|
|
12846
13026
|
isPasswordHashPath,
|
|
12847
13027
|
isPrivateHost,
|
|
12848
13028
|
isProtectedHomePath,
|
|
@@ -12850,16 +13030,24 @@ export {
|
|
|
12850
13030
|
isShieldVerdict,
|
|
12851
13031
|
isStrictGatedTier,
|
|
12852
13032
|
isVerdict,
|
|
13033
|
+
maskDestination,
|
|
13034
|
+
maskPersonalData,
|
|
13035
|
+
maskPersonalValue,
|
|
12853
13036
|
matchCanary,
|
|
12854
13037
|
matchCanaryArgs,
|
|
12855
13038
|
matchSensitivePath2 as matchSensitivePath,
|
|
12856
13039
|
matchesPattern,
|
|
13040
|
+
matchesTrustedEntry,
|
|
13041
|
+
matchesTrustedList,
|
|
12857
13042
|
narrativeRuleLabel,
|
|
12858
13043
|
normalizeCommandForPolicy,
|
|
13044
|
+
normalizeDestination,
|
|
12859
13045
|
normalizeFilePath,
|
|
12860
13046
|
normalizeForScan,
|
|
12861
13047
|
normalizeIpLiteral,
|
|
12862
13048
|
normalizePyPiName,
|
|
13049
|
+
normalizeRecipient,
|
|
13050
|
+
normalizeTrustedEntry,
|
|
12863
13051
|
parseAllSshHostsFromCommand,
|
|
12864
13052
|
parseDestHost,
|
|
12865
13053
|
patternShapeOf,
|
|
@@ -12893,6 +13081,7 @@ export {
|
|
|
12893
13081
|
toScanFinding,
|
|
12894
13082
|
toolMatchesRule,
|
|
12895
13083
|
truncateBlastPath,
|
|
13084
|
+
trustedEntryOf,
|
|
12896
13085
|
tuningFromLegacyPolicy,
|
|
12897
13086
|
tuningToLegacyPolicy,
|
|
12898
13087
|
unwrapCommandHead,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/policy-engine",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.1",
|
|
4
4
|
"description": "Shared policy evaluation engine for node9 — DLP, smart rules, AST shell parsing, shields, loop detection. Pure functions, no I/O. Used by both node9-proxy and the node9 SaaS firewall.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://node9.ai",
|