DynamicRuleManager
Defined in: packages/core/src/handlers/dynamic-rules.ts:45
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DynamicRuleManager(
config,logger):DynamicRuleManager
Defined in: packages/core/src/handlers/dynamic-rules.ts:59
Parameters
Section titled “Parameters”config
Section titled “config”agentApiKey
Section titled “agentApiKey”string | null = ...
agentBackoffFactor
Section titled “agentBackoffFactor”number | null = ...
agentBufferOverflowPolicy
Section titled “agentBufferOverflowPolicy”"drop" | "block" | "raise" | null = ...
agentBufferSize
Section titled “agentBufferSize”number = ...
agentCompressionEnabled
Section titled “agentCompressionEnabled”boolean | null = ...
agentCompressionThreshold
Section titled “agentCompressionThreshold”number | null = ...
agentEnableEvents
Section titled “agentEnableEvents”boolean = ...
agentEnableMetrics
Section titled “agentEnableMetrics”boolean = ...
agentEndpoint
Section titled “agentEndpoint”string = ...
agentFlushInterval
Section titled “agentFlushInterval”number = ...
agentGuardVersion
Section titled “agentGuardVersion”string | null = ...
agentHighWatermarkRatio
Section titled “agentHighWatermarkRatio”number | null = ...
agentInstallId
Section titled “agentInstallId”string | null = ...
agentMaxConcurrentFlushes
Section titled “agentMaxConcurrentFlushes”number | null = ...
agentMaxPayloadSize
Section titled “agentMaxPayloadSize”number | null = ...
agentPayloadSigningSecret
Section titled “agentPayloadSigningSecret”string | null = ...
agentProjectEncryptionKey
Section titled “agentProjectEncryptionKey”string | null = ...
agentProjectId
Section titled “agentProjectId”string | null = ...
agentRetryAttempts
Section titled “agentRetryAttempts”number = ...
agentSensitiveHeaders
Section titled “agentSensitiveHeaders”string[] | null = ...
agentStatusInterval
Section titled “agentStatusInterval”number = ...
agentStrict
Section titled “agentStrict”boolean = ...
agentTimeout
Section titled “agentTimeout”number = ...
authVerifier?
Section titled “authVerifier?”(request, credential) => unknown = ...
autoBanDuration
Section titled “autoBanDuration”number = ...
autoBanThreshold
Section titled “autoBanThreshold”number = ...
behaviorMaxResponseBodyInspectBytes
Section titled “behaviorMaxResponseBodyInspectBytes”number = ...
behaviorScanResponseBody
Section titled “behaviorScanResponseBody”boolean = ...
blacklist
Section titled “blacklist”string[] = ...
blockCloudProviders
Section titled “blockCloudProviders”Set<"AWS" | "GCP" | "Azure"> = ...
blockedCountries
Section titled “blockedCountries”string[] = ...
blockedUserAgents
Section titled “blockedUserAgents”string[] = ...
bodyReadMaxConcurrent
Section titled “bodyReadMaxConcurrent”number = ...
bodyReadTimeout
Section titled “bodyReadTimeout”number = ...
cloudIpRefreshInterval
Section titled “cloudIpRefreshInterval”number = ...
corsAllowCredentials
Section titled “corsAllowCredentials”boolean = ...
corsAllowHeaders
Section titled “corsAllowHeaders”string[] = ...
corsAllowMethods
Section titled “corsAllowMethods”string[] = ...
corsAllowOrigins
Section titled “corsAllowOrigins”string[] = ...
corsExposeHeaders
Section titled “corsExposeHeaders”string[] = ...
corsMaxAge
Section titled “corsMaxAge”number = ...
customErrorResponses
Section titled “customErrorResponses”Record<number, string> = ...
customLogFile
Section titled “customLogFile”string | null = ...
customRequestCheck?
Section titled “customRequestCheck?”(req) => Promise<GuardResponse | null> = ...
customResponseModifier?
Section titled “customResponseModifier?”(res) => Promise<GuardResponse> = ...
detectionAnomalyEmissionCooldown
Section titled “detectionAnomalyEmissionCooldown”number = ...
detectionAnomalyThreshold
Section titled “detectionAnomalyThreshold”number = ...
detectionBinaryMinRunLength
Section titled “detectionBinaryMinRunLength”number = ...
detectionCompilerTimeout
Section titled “detectionCompilerTimeout”number = ...
detectionMaxBodyInspectBytes
Section titled “detectionMaxBodyInspectBytes”number = ...
detectionMaxContentLength
Section titled “detectionMaxContentLength”number = ...
detectionMaxJsonDepth
Section titled “detectionMaxJsonDepth”number = ...
detectionMaxScanChars
Section titled “detectionMaxScanChars”number = ...
detectionMaxScanValues
Section titled “detectionMaxScanValues”number = ...
detectionMaxTrackedPatterns
Section titled “detectionMaxTrackedPatterns”number = ...
detectionMinSamplesForAnomaly
Section titled “detectionMinSamplesForAnomaly”number = ...
detectionMonitorHistorySize
Section titled “detectionMonitorHistorySize”number = ...
detectionPatternValidationCachePath
Section titled “detectionPatternValidationCachePath”string | null = ...
detectionPreserveAttackPatterns
Section titled “detectionPreserveAttackPatterns”boolean = ...
detectionScanBody
Section titled “detectionScanBody”boolean = ...
detectionScanWorkerPool
Section titled “detectionScanWorkerPool”boolean = ...
detectionSemanticThreshold
Section titled “detectionSemanticThreshold”number = ...
detectionSlowPatternThreshold
Section titled “detectionSlowPatternThreshold”number = ...
detectionThreatScoreThreshold
Section titled “detectionThreatScoreThreshold”number = ...
dynamicRuleInterval
Section titled “dynamicRuleInterval”number = ...
dynamicRulesCachePath
Section titled “dynamicRulesCachePath”string | null = ...
emergencyMode
Section titled “emergencyMode”boolean = ...
emergencyWhitelist
Section titled “emergencyWhitelist”string[] = ...
enableAgent
Section titled “enableAgent”boolean = ...
enableCors
Section titled “enableCors”boolean = ...
enabledDetectionCategories
Section titled “enabledDetectionCategories”string[] = ...
enableDynamicRules
Section titled “enableDynamicRules”boolean = ...
enableEnrichment
Section titled “enableEnrichment”boolean = ...
enableIpBanning
Section titled “enableIpBanning”boolean = ...
enableLogfire
Section titled “enableLogfire”boolean = ...
enableOtel
Section titled “enableOtel”boolean = ...
enablePenetrationDetection
Section titled “enablePenetrationDetection”boolean = ...
enableRateLimitAutoBan
Section titled “enableRateLimitAutoBan”boolean = ...
enableRateLimiting
Section titled “enableRateLimiting”boolean = ...
enableRedis
Section titled “enableRedis”boolean = ...
endpointRateLimits
Section titled “endpointRateLimits”Record<string, [number, number]> = ...
enforceHttps
Section titled “enforceHttps”boolean = ...
excludedDetectionBodyFields
Section titled “excludedDetectionBodyFields”string[] = ...
excludedDetectionHeaders
Section titled “excludedDetectionHeaders”string[] = ...
excludedDetectionParams
Section titled “excludedDetectionParams”string[] = ...
excludePaths
Section titled “excludePaths”string[] = ...
exemptIps
Section titled “exemptIps”string[] = ...
failSecure
Section titled “failSecure”boolean = ...
geoIpDbMaxAge
Section titled “geoIpDbMaxAge”number = ...
geoIpHandler?
Section titled “geoIpHandler?”GeoIPHandler = ...
geoResolver?
Section titled “geoResolver?”(ip) => string | null = ...
globalBehaviorRules
Section titled “globalBehaviorRules”object[] = ...
ipinfoDbPath
Section titled “ipinfoDbPath”string = ...
ipinfoToken
Section titled “ipinfoToken”string | null = ...
lazyInit
Section titled “lazyInit”boolean = ...
logCountryCheckLevel
Section titled “logCountryCheckLevel”"INFO" | "DEBUG" | "WARNING" | "ERROR" | "CRITICAL" | null = ...
logfireServiceName
Section titled “logfireServiceName”string = ...
logFormat
Section titled “logFormat”"text" | "json" = ...
logger?
Section titled “logger?”Logger = ...
logRequestLevel
Section titled “logRequestLevel”"INFO" | "DEBUG" | "WARNING" | "ERROR" | "CRITICAL" | null = ...
logSensitiveBodyFields
Section titled “logSensitiveBodyFields”string[] = ...
logSensitiveHeaders
Section titled “logSensitiveHeaders”string[] = ...
logSensitiveParams
Section titled “logSensitiveParams”string[] = ...
logSuspiciousLevel
Section titled “logSuspiciousLevel”"INFO" | "DEBUG" | "WARNING" | "ERROR" | "CRITICAL" | null = ...
mutedCheckLogs
Section titled “mutedCheckLogs”string[] = ...
mutedEventTypes
Section titled “mutedEventTypes”string[] = ...
mutedMetricTypes
Section titled “mutedMetricTypes”string[] = ...
onBlock?
Section titled “onBlock?”(request, payload) => unknown = ...
onError?
Section titled “onError?”(stage, error, context) => void = ...
otelExporterEndpoint
Section titled “otelExporterEndpoint”string | null = ...
otelResourceAttributes
Section titled “otelResourceAttributes”Record<string, string> = ...
otelServiceName
Section titled “otelServiceName”string = ...
passiveMode
Section titled “passiveMode”boolean = ...
rateLimit
Section titled “rateLimit”number = ...
rateLimitWindow
Section titled “rateLimitWindow”number = ...
redisFailOpen
Section titled “redisFailOpen”boolean = ...
redisHealthCheckInterval
Section titled “redisHealthCheckInterval”number = ...
redisMaxConnections
Section titled “redisMaxConnections”number | null = ...
redisPrefix
Section titled “redisPrefix”string = ...
redisRetries
Section titled “redisRetries”number = ...
redisSocketConnectTimeout
Section titled “redisSocketConnectTimeout”number | null = ...
redisSocketTimeout
Section titled “redisSocketTimeout”number | null = ...
redisUrl
Section titled “redisUrl”string = ...
routeResolutionStrict
Section titled “routeResolutionStrict”boolean = ...
securityHeaders
Section titled “securityHeaders”{ contentTypeOptions: string; csp: Record<string, string[]> | null; custom: Record<string, string> | null; enabled: boolean; frameOptions: "DENY" | "SAMEORIGIN"; hsts?: { includeSubdomains: boolean; maxAge: number; preload: boolean; }; permissionsPolicy: string; referrerPolicy: string; xssProtection: string; } | null = ...
threatBanConfig
Section titled “threatBanConfig”Record<string, { duration: number; threshold: number; }> = ...
trustedProxies
Section titled “trustedProxies”string[] = ...
trustedProxyDepth
Section titled “trustedProxyDepth”number = ...
trustXForwardedProto
Section titled “trustXForwardedProto”boolean = ...
whitelist
Section titled “whitelist”string[] | null = ...
whitelistCountries
Section titled “whitelistCountries”string[] = ...
logger
Section titled “logger”Returns
Section titled “Returns”DynamicRuleManager
Methods
Section titled “Methods”forceUpdate()
Section titled “forceUpdate()”forceUpdate():
Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:437
Returns
Section titled “Returns”Promise<void>
getCurrentRules()
Section titled “getCurrentRules()”getCurrentRules(): {
blockedCloudProviders:Set<"AWS"|"GCP"|"Azure">;blockedCountries:string[];blockedUserAgents:string[];emergencyMode:boolean;emergencyWhitelist:string[];enableIpBanning:boolean|null;enablePenetrationDetection:boolean|null;enableRateLimiting:boolean|null;endpointRateLimits:Record<string, [number,number]>;expiresAt:string|null;globalRateLimit:number|null;globalRateWindow:number|null;ipBanDuration:number;ipBlacklist:string[];ipWhitelist:string[];ruleId:string;suspiciousPatterns:string[];timestamp:string;ttl:number;version:number;whitelistCountries:string[]; } |null
Defined in: packages/core/src/handlers/dynamic-rules.ts:345
Returns
Section titled “Returns”{ blockedCloudProviders: Set<"AWS" | "GCP" | "Azure">; blockedCountries: string[]; blockedUserAgents: string[]; emergencyMode: boolean; emergencyWhitelist: string[]; enableIpBanning: boolean | null; enablePenetrationDetection: boolean | null; enableRateLimiting: boolean | null; endpointRateLimits: Record<string, [number, number]>; expiresAt: string | null; globalRateLimit: number | null; globalRateWindow: number | null; ipBanDuration: number; ipBlacklist: string[]; ipWhitelist: string[]; ruleId: string; suspiciousPatterns: string[]; timestamp: string; ttl: number; version: number; whitelistCountries: string[]; } | null
hydrateLastKnownRules()
Section titled “hydrateLastKnownRules()”hydrateLastKnownRules():
Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:85
Returns
Section titled “Returns”Promise<void>
initializeAgent()
Section titled “initializeAgent()”initializeAgent(
agentHandler):Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:64
Parameters
Section titled “Parameters”agentHandler
Section titled “agentHandler”Returns
Section titled “Returns”Promise<void>
initializeRedis()
Section titled “initializeRedis()”initializeRedis(
redisHandler):Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:75
Parameters
Section titled “Parameters”redisHandler
Section titled “redisHandler”Returns
Section titled “Returns”Promise<void>
loadLastKnownRules()
Section titled “loadLastKnownRules()”loadLastKnownRules():
Promise<{blockedCloudProviders:Set<"AWS"|"GCP"|"Azure">;blockedCountries:string[];blockedUserAgents:string[];emergencyMode:boolean;emergencyWhitelist:string[];enableIpBanning:boolean|null;enablePenetrationDetection:boolean|null;enableRateLimiting:boolean|null;endpointRateLimits:Record<string, [number,number]>;expiresAt:string|null;globalRateLimit:number|null;globalRateWindow:number|null;ipBanDuration:number;ipBlacklist:string[];ipWhitelist:string[];ruleId:string;suspiciousPatterns:string[];timestamp:string;ttl:number;version:number;whitelistCountries:string[]; } |null>
Defined in: packages/core/src/handlers/dynamic-rules.ts:108
Returns
Section titled “Returns”Promise<{ blockedCloudProviders: Set<"AWS" | "GCP" | "Azure">; blockedCountries: string[]; blockedUserAgents: string[]; emergencyMode: boolean; emergencyWhitelist: string[]; enableIpBanning: boolean | null; enablePenetrationDetection: boolean | null; enableRateLimiting: boolean | null; endpointRateLimits: Record<string, [number, number]>; expiresAt: string | null; globalRateLimit: number | null; globalRateWindow: number | null; ipBanDuration: number; ipBlacklist: string[]; ipWhitelist: string[]; ruleId: string; suspiciousPatterns: string[]; timestamp: string; ttl: number; version: number; whitelistCountries: string[]; } | null>
matchEvent()
Section titled “matchEvent()”matchEvent(
event): {ruleId:string;version:number; } |null
Defined in: packages/core/src/handlers/dynamic-rules.ts:387
Parameters
Section titled “Parameters”country?
Section titled “country?”string | null
eventType?
Section titled “eventType?”string | null
ipAddress?
Section titled “ipAddress?”string | null
Returns
Section titled “Returns”{ ruleId: string; version: number; } | null
persistLastKnownRules()
Section titled “persistLastKnownRules()”persistLastKnownRules(
rules):Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:198
Parameters
Section titled “Parameters”blockedCloudProviders
Section titled “blockedCloudProviders”Set<"AWS" | "GCP" | "Azure"> = ...
blockedCountries
Section titled “blockedCountries”string[] = ...
blockedUserAgents
Section titled “blockedUserAgents”string[] = ...
emergencyMode
Section titled “emergencyMode”boolean = ...
emergencyWhitelist
Section titled “emergencyWhitelist”string[] = ...
enableIpBanning
Section titled “enableIpBanning”boolean | null = ...
enablePenetrationDetection
Section titled “enablePenetrationDetection”boolean | null = ...
enableRateLimiting
Section titled “enableRateLimiting”boolean | null = ...
endpointRateLimits
Section titled “endpointRateLimits”Record<string, [number, number]> = ...
expiresAt
Section titled “expiresAt”string | null = ...
globalRateLimit
Section titled “globalRateLimit”number | null = ...
globalRateWindow
Section titled “globalRateWindow”number | null = ...
ipBanDuration
Section titled “ipBanDuration”number = ...
ipBlacklist
Section titled “ipBlacklist”string[] = ...
ipWhitelist
Section titled “ipWhitelist”string[] = ...
ruleId
Section titled “ruleId”string = ...
suspiciousPatterns
Section titled “suspiciousPatterns”string[] = ...
timestamp
Section titled “timestamp”string = ...
number = ...
version
Section titled “version”number = ...
whitelistCountries
Section titled “whitelistCountries”string[] = ...
Returns
Section titled “Returns”Promise<void>
stop()
Section titled “stop()”stop():
Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:441
Returns
Section titled “Returns”Promise<void>
updateRules()
Section titled “updateRules()”updateRules():
Promise<void>
Defined in: packages/core/src/handlers/dynamic-rules.ts:262
Returns
Section titled “Returns”Promise<void>