RequestValidator
Defined in: packages/core/src/core/validation/validator.ts:9
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RequestValidator(
config,logger,eventBus):RequestValidator
Defined in: packages/core/src/core/validation/validator.ts:10
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”eventBus
Section titled “eventBus”Returns
Section titled “Returns”RequestValidator
Methods
Section titled “Methods”checkTimeWindow()
Section titled “checkTimeWindow()”checkTimeWindow(
timeRestrictions):Promise<boolean>
Defined in: packages/core/src/core/validation/validator.ts:52
Parameters
Section titled “Parameters”timeRestrictions
Section titled “timeRestrictions”string
string
Returns
Section titled “Returns”Promise<boolean>
isPathExcluded()
Section titled “isPathExcluded()”isPathExcluded(
request):Promise<boolean>
Defined in: packages/core/src/core/validation/validator.ts:70
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<boolean>
isRequestHttps()
Section titled “isRequestHttps()”isRequestHttps(
request):boolean
Defined in: packages/core/src/core/validation/validator.ts:16
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”boolean
isTrustedProxy()
Section titled “isTrustedProxy()”isTrustedProxy(
connectingIp):boolean
Defined in: packages/core/src/core/validation/validator.ts:35
Parameters
Section titled “Parameters”connectingIp
Section titled “connectingIp”string
Returns
Section titled “Returns”boolean