GuardMiddlewareProtocol
Defined in: packages/core/src/protocols/middleware.ts:7
Properties
Section titled “Properties”agentHandler
Section titled “agentHandler”
readonlyagentHandler:AgentHandlerProtocol|null
Defined in: packages/core/src/protocols/middleware.ts:20
config
Section titled “config”
readonlyconfig:object
Defined in: packages/core/src/protocols/middleware.ts:8
agentApiKey
Section titled “agentApiKey”agentApiKey:
string|null
agentBackoffFactor
Section titled “agentBackoffFactor”agentBackoffFactor:
number|null
agentBufferOverflowPolicy
Section titled “agentBufferOverflowPolicy”agentBufferOverflowPolicy:
"drop"|"block"|"raise"|null
agentBufferSize
Section titled “agentBufferSize”agentBufferSize:
number
agentCompressionEnabled
Section titled “agentCompressionEnabled”agentCompressionEnabled:
boolean|null
agentCompressionThreshold
Section titled “agentCompressionThreshold”agentCompressionThreshold:
number|null
agentEnableEvents
Section titled “agentEnableEvents”agentEnableEvents:
boolean
agentEnableMetrics
Section titled “agentEnableMetrics”agentEnableMetrics:
boolean
agentEndpoint
Section titled “agentEndpoint”agentEndpoint:
string
agentFlushInterval
Section titled “agentFlushInterval”agentFlushInterval:
number
agentGuardVersion
Section titled “agentGuardVersion”agentGuardVersion:
string|null
agentHighWatermarkRatio
Section titled “agentHighWatermarkRatio”agentHighWatermarkRatio:
number|null
agentInstallId
Section titled “agentInstallId”agentInstallId:
string|null
agentMaxConcurrentFlushes
Section titled “agentMaxConcurrentFlushes”agentMaxConcurrentFlushes:
number|null
agentMaxPayloadSize
Section titled “agentMaxPayloadSize”agentMaxPayloadSize:
number|null
agentPayloadSigningSecret
Section titled “agentPayloadSigningSecret”agentPayloadSigningSecret:
string|null
agentProjectEncryptionKey
Section titled “agentProjectEncryptionKey”agentProjectEncryptionKey:
string|null
agentProjectId
Section titled “agentProjectId”agentProjectId:
string|null
agentRetryAttempts
Section titled “agentRetryAttempts”agentRetryAttempts:
number
agentSensitiveHeaders
Section titled “agentSensitiveHeaders”agentSensitiveHeaders:
string[] |null
agentStatusInterval
Section titled “agentStatusInterval”agentStatusInterval:
number
agentStrict
Section titled “agentStrict”agentStrict:
boolean
agentTimeout
Section titled “agentTimeout”agentTimeout:
number
authVerifier?
Section titled “authVerifier?”
optionalauthVerifier?: (request,credential) =>unknown
Parameters
Section titled “Parameters”request
Section titled “request”credential
Section titled “credential”string
Returns
Section titled “Returns”unknown
autoBanDuration
Section titled “autoBanDuration”autoBanDuration:
number
autoBanThreshold
Section titled “autoBanThreshold”autoBanThreshold:
number
behaviorMaxResponseBodyInspectBytes
Section titled “behaviorMaxResponseBodyInspectBytes”behaviorMaxResponseBodyInspectBytes:
number
behaviorScanResponseBody
Section titled “behaviorScanResponseBody”behaviorScanResponseBody:
boolean
blacklist
Section titled “blacklist”blacklist:
string[]
blockCloudProviders
Section titled “blockCloudProviders”blockCloudProviders:
Set<"AWS"|"GCP"|"Azure">
blockedCountries
Section titled “blockedCountries”blockedCountries:
string[]
blockedUserAgents
Section titled “blockedUserAgents”blockedUserAgents:
string[]
bodyReadMaxConcurrent
Section titled “bodyReadMaxConcurrent”bodyReadMaxConcurrent:
number
bodyReadTimeout
Section titled “bodyReadTimeout”bodyReadTimeout:
number
cloudIpRefreshInterval
Section titled “cloudIpRefreshInterval”cloudIpRefreshInterval:
number
corsAllowCredentials
Section titled “corsAllowCredentials”corsAllowCredentials:
boolean
corsAllowHeaders
Section titled “corsAllowHeaders”corsAllowHeaders:
string[]
corsAllowMethods
Section titled “corsAllowMethods”corsAllowMethods:
string[]
corsAllowOrigins
Section titled “corsAllowOrigins”corsAllowOrigins:
string[]
corsExposeHeaders
Section titled “corsExposeHeaders”corsExposeHeaders:
string[]
corsMaxAge
Section titled “corsMaxAge”corsMaxAge:
number
customErrorResponses
Section titled “customErrorResponses”customErrorResponses:
Record<number,string>
customLogFile
Section titled “customLogFile”customLogFile:
string|null
customRequestCheck?
Section titled “customRequestCheck?”
optionalcustomRequestCheck?: (req) =>Promise<GuardResponse|null>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<GuardResponse | null>
customResponseModifier?
Section titled “customResponseModifier?”
optionalcustomResponseModifier?: (res) =>Promise<GuardResponse>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<GuardResponse>
detectionAnomalyEmissionCooldown
Section titled “detectionAnomalyEmissionCooldown”detectionAnomalyEmissionCooldown:
number
detectionAnomalyThreshold
Section titled “detectionAnomalyThreshold”detectionAnomalyThreshold:
number
detectionBinaryMinRunLength
Section titled “detectionBinaryMinRunLength”detectionBinaryMinRunLength:
number
detectionCompilerTimeout
Section titled “detectionCompilerTimeout”detectionCompilerTimeout:
number
detectionMaxBodyInspectBytes
Section titled “detectionMaxBodyInspectBytes”detectionMaxBodyInspectBytes:
number
detectionMaxContentLength
Section titled “detectionMaxContentLength”detectionMaxContentLength:
number
detectionMaxJsonDepth
Section titled “detectionMaxJsonDepth”detectionMaxJsonDepth:
number
detectionMaxScanChars
Section titled “detectionMaxScanChars”detectionMaxScanChars:
number
detectionMaxScanValues
Section titled “detectionMaxScanValues”detectionMaxScanValues:
number
detectionMaxTrackedPatterns
Section titled “detectionMaxTrackedPatterns”detectionMaxTrackedPatterns:
number
detectionMinSamplesForAnomaly
Section titled “detectionMinSamplesForAnomaly”detectionMinSamplesForAnomaly:
number
detectionMonitorHistorySize
Section titled “detectionMonitorHistorySize”detectionMonitorHistorySize:
number
detectionPatternValidationCachePath
Section titled “detectionPatternValidationCachePath”detectionPatternValidationCachePath:
string|null
detectionPreserveAttackPatterns
Section titled “detectionPreserveAttackPatterns”detectionPreserveAttackPatterns:
boolean
detectionScanBody
Section titled “detectionScanBody”detectionScanBody:
boolean
detectionScanWorkerPool
Section titled “detectionScanWorkerPool”detectionScanWorkerPool:
boolean
detectionSemanticThreshold
Section titled “detectionSemanticThreshold”detectionSemanticThreshold:
number
detectionSlowPatternThreshold
Section titled “detectionSlowPatternThreshold”detectionSlowPatternThreshold:
number
detectionThreatScoreThreshold
Section titled “detectionThreatScoreThreshold”detectionThreatScoreThreshold:
number
dynamicRuleInterval
Section titled “dynamicRuleInterval”dynamicRuleInterval:
number
dynamicRulesCachePath
Section titled “dynamicRulesCachePath”dynamicRulesCachePath:
string|null
emergencyMode
Section titled “emergencyMode”emergencyMode:
boolean
emergencyWhitelist
Section titled “emergencyWhitelist”emergencyWhitelist:
string[]
enableAgent
Section titled “enableAgent”enableAgent:
boolean
enableCors
Section titled “enableCors”enableCors:
boolean
enabledDetectionCategories
Section titled “enabledDetectionCategories”enabledDetectionCategories:
string[]
enableDynamicRules
Section titled “enableDynamicRules”enableDynamicRules:
boolean
enableEnrichment
Section titled “enableEnrichment”enableEnrichment:
boolean
enableIpBanning
Section titled “enableIpBanning”enableIpBanning:
boolean
enableLogfire
Section titled “enableLogfire”enableLogfire:
boolean
enableOtel
Section titled “enableOtel”enableOtel:
boolean
enablePenetrationDetection
Section titled “enablePenetrationDetection”enablePenetrationDetection:
boolean
enableRateLimitAutoBan
Section titled “enableRateLimitAutoBan”enableRateLimitAutoBan:
boolean
enableRateLimiting
Section titled “enableRateLimiting”enableRateLimiting:
boolean
enableRedis
Section titled “enableRedis”enableRedis:
boolean
endpointRateLimits
Section titled “endpointRateLimits”endpointRateLimits:
Record<string, [number,number]>
enforceHttps
Section titled “enforceHttps”enforceHttps:
boolean
excludedDetectionBodyFields
Section titled “excludedDetectionBodyFields”excludedDetectionBodyFields:
string[]
excludedDetectionHeaders
Section titled “excludedDetectionHeaders”excludedDetectionHeaders:
string[]
excludedDetectionParams
Section titled “excludedDetectionParams”excludedDetectionParams:
string[]
excludePaths
Section titled “excludePaths”excludePaths:
string[]
exemptIps
Section titled “exemptIps”exemptIps:
string[]
failSecure
Section titled “failSecure”failSecure:
boolean
geoIpDbMaxAge
Section titled “geoIpDbMaxAge”geoIpDbMaxAge:
number
geoIpHandler?
Section titled “geoIpHandler?”
optionalgeoIpHandler?:GeoIPHandler
geoResolver?
Section titled “geoResolver?”
optionalgeoResolver?: (ip) =>string|null
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string | null
globalBehaviorRules
Section titled “globalBehaviorRules”globalBehaviorRules:
object[]
ipinfoDbPath
Section titled “ipinfoDbPath”ipinfoDbPath:
string
ipinfoToken
Section titled “ipinfoToken”ipinfoToken:
string|null
lazyInit
Section titled “lazyInit”lazyInit:
boolean
logCountryCheckLevel
Section titled “logCountryCheckLevel”logCountryCheckLevel:
"INFO"|"DEBUG"|"WARNING"|"ERROR"|"CRITICAL"|null
logfireServiceName
Section titled “logfireServiceName”logfireServiceName:
string
logFormat
Section titled “logFormat”logFormat:
"text"|"json"
logger?
Section titled “logger?”
optionallogger?:Logger
logRequestLevel
Section titled “logRequestLevel”logRequestLevel:
"INFO"|"DEBUG"|"WARNING"|"ERROR"|"CRITICAL"|null
logSensitiveBodyFields
Section titled “logSensitiveBodyFields”logSensitiveBodyFields:
string[]
logSensitiveHeaders
Section titled “logSensitiveHeaders”logSensitiveHeaders:
string[]
logSensitiveParams
Section titled “logSensitiveParams”logSensitiveParams:
string[]
logSuspiciousLevel
Section titled “logSuspiciousLevel”logSuspiciousLevel:
"INFO"|"DEBUG"|"WARNING"|"ERROR"|"CRITICAL"|null
mutedCheckLogs
Section titled “mutedCheckLogs”mutedCheckLogs:
string[]
mutedEventTypes
Section titled “mutedEventTypes”mutedEventTypes:
string[]
mutedMetricTypes
Section titled “mutedMetricTypes”mutedMetricTypes:
string[]
onBlock?
Section titled “onBlock?”
optionalonBlock?: (request,payload) =>unknown
Parameters
Section titled “Parameters”request
Section titled “request”payload
Section titled “payload”Record<string, unknown>
Returns
Section titled “Returns”unknown
onError?
Section titled “onError?”
optionalonError?: (stage,error,context) =>void
Parameters
Section titled “Parameters”string
unknown
context
Section titled “context”Record<string, unknown>
Returns
Section titled “Returns”void
otelExporterEndpoint
Section titled “otelExporterEndpoint”otelExporterEndpoint:
string|null
otelResourceAttributes
Section titled “otelResourceAttributes”otelResourceAttributes:
Record<string,string>
otelServiceName
Section titled “otelServiceName”otelServiceName:
string
passiveMode
Section titled “passiveMode”passiveMode:
boolean
rateLimit
Section titled “rateLimit”rateLimit:
number
rateLimitWindow
Section titled “rateLimitWindow”rateLimitWindow:
number
redisFailOpen
Section titled “redisFailOpen”redisFailOpen:
boolean
redisHealthCheckInterval
Section titled “redisHealthCheckInterval”redisHealthCheckInterval:
number
redisMaxConnections
Section titled “redisMaxConnections”redisMaxConnections:
number|null
redisPrefix
Section titled “redisPrefix”redisPrefix:
string
redisRetries
Section titled “redisRetries”redisRetries:
number
redisSocketConnectTimeout
Section titled “redisSocketConnectTimeout”redisSocketConnectTimeout:
number|null
redisSocketTimeout
Section titled “redisSocketTimeout”redisSocketTimeout:
number|null
redisUrl
Section titled “redisUrl”redisUrl:
string
routeResolutionStrict
Section titled “routeResolutionStrict”routeResolutionStrict:
boolean
securityHeaders
Section titled “securityHeaders”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”threatBanConfig:
Record<string, {duration:number;threshold:number; }>
trustedProxies
Section titled “trustedProxies”trustedProxies:
string[]
trustedProxyDepth
Section titled “trustedProxyDepth”trustedProxyDepth:
number
trustXForwardedProto
Section titled “trustXForwardedProto”trustXForwardedProto:
boolean
whitelist
Section titled “whitelist”whitelist:
string[] |null
whitelistCountries
Section titled “whitelistCountries”whitelistCountries:
string[]
eventBus
Section titled “eventBus”
readonlyeventBus:unknown
Defined in: packages/core/src/protocols/middleware.ts:16
geoIpHandler
Section titled “geoIpHandler”
readonlygeoIpHandler:GeoIPHandler|null
Defined in: packages/core/src/protocols/middleware.ts:21
guardResponseFactory
Section titled “guardResponseFactory”
readonlyguardResponseFactory:GuardResponseFactory
Defined in: packages/core/src/protocols/middleware.ts:22
lastCloudIpRefresh
Section titled “lastCloudIpRefresh”lastCloudIpRefresh:
number
Defined in: packages/core/src/protocols/middleware.ts:10
logger
Section titled “logger”
readonlylogger:Logger
Defined in: packages/core/src/protocols/middleware.ts:9
rateLimitHandler
Section titled “rateLimitHandler”
readonlyrateLimitHandler:unknown
Defined in: packages/core/src/protocols/middleware.ts:19
responseFactory
Section titled “responseFactory”
readonlyresponseFactory:unknown
Defined in: packages/core/src/protocols/middleware.ts:18
routeResolver
Section titled “routeResolver”
readonlyrouteResolver:unknown
Defined in: packages/core/src/protocols/middleware.ts:17
suspiciousRequestCounts
Section titled “suspiciousRequestCounts”suspiciousRequestCounts:
Map<string,Map<string,number>>
Defined in: packages/core/src/protocols/middleware.ts:15
Methods
Section titled “Methods”createErrorResponse()
Section titled “createErrorResponse()”createErrorResponse(
statusCode,defaultMessage):Promise<GuardResponse>
Defined in: packages/core/src/protocols/middleware.ts:23
Parameters
Section titled “Parameters”statusCode
Section titled “statusCode”number
defaultMessage
Section titled “defaultMessage”string
Returns
Section titled “Returns”Promise<GuardResponse>
refreshCloudIpRanges()
Section titled “refreshCloudIpRanges()”refreshCloudIpRanges():
Promise<void>
Defined in: packages/core/src/protocols/middleware.ts:24
Returns
Section titled “Returns”Promise<void>