/** * hppx — Superior HTTP Parameter Pollution protection middleware * * - Protects against parameter and prototype pollution * - Supports nested whitelists via dot-notation and leaf matching * - Merge strategies: keepFirst | keepLast | combine * - Multiple middleware compatibility: arrays are "put aside" once and selectively restored * - Exposes req.queryPolluted / req.bodyPolluted / req.paramsPolluted * - TypeScript-first API */ declare module "express-serve-static-core" { interface Request { queryPolluted?: Record; bodyPolluted?: Record; paramsPolluted?: Record; } } type RequestSource = "query" | "body" | "params"; type MergeStrategy = "keepFirst" | "keepLast" | "combine"; interface SanitizeOptions { whitelist?: string[] | string; mergeStrategy?: MergeStrategy; maxDepth?: number; maxKeys?: number; maxArrayLength?: number; maxKeyLength?: number; trimValues?: boolean; preserveNull?: boolean; } interface HppxOptions extends SanitizeOptions { sources?: RequestSource[]; /** When to process req.body */ checkBodyContentType?: "urlencoded" | "any" | "none"; excludePaths?: string[]; strict?: boolean; onPollutionDetected?: (req: Record, info: { source: RequestSource; pollutedKeys: string[]; }) => void; logger?: (err: Error | unknown) => void; /** Enable logging when pollution is detected (default: true) */ logPollution?: boolean; } interface SanitizedResult { cleaned: T; pollutedTree: Record; pollutedKeys: string[]; } declare const DEFAULT_SOURCES: RequestSource[]; declare const DEFAULT_STRATEGY: MergeStrategy; declare const DANGEROUS_KEYS: Set; /** * @internal — test-only helper that resets the module-level path segment cache. * Public callers must not depend on this; it exists solely so tests can verify * cache eviction behavior without exposing the internal Map. */ declare function __resetPathSegmentCache(): void; declare function sanitize>(input: T, options?: SanitizeOptions): T; type ExpressLikeNext = (err?: unknown) => void; declare function hppx(options?: HppxOptions): (req: any, res: any, next: ExpressLikeNext) => any; export { DANGEROUS_KEYS, DEFAULT_SOURCES, DEFAULT_STRATEGY, type HppxOptions, type MergeStrategy, type RequestSource, type SanitizeOptions, type SanitizedResult, __resetPathSegmentCache, hppx as default, sanitize };