///
import { Request } from '@loopback/rest';
import { SqlInjectionConfig } from '../types';
import { SecurityLogger } from '../utils/security-logger';
/**
* SQL injection detector that scans for common SQL injection patterns
*/
export declare class SqlInjectionDetector {
private config?;
private logger?;
private readonly defaultPatterns;
private patterns;
private whitelistedQueries;
private skipFields;
constructor(config?: SqlInjectionConfig | undefined, logger?: SecurityLogger | undefined, skipFields?: string[]);
/**
* Detect SQL injection attempts in the request
*/
detectSqlInjection(req: Request): Promise;
/**
* Check if a field should be skipped from SQL injection detection
*/
private shouldSkipField;
/**
* Scan object recursively for SQL injection patterns
*/
private scanObject;
/**
* Scan URL parameters with more lenient patterns to allow legitimate URL characters
*/
private scanUrlParameter;
/**
* Scan headers for SQL injection attempts
*/
private scanHeaders;
/**
* Scan header values with more restrictive patterns to avoid false positives
* while still catching obvious SQL injection attempts
*/
private scanHeaderValueCarefully;
/**
* Helper method to log and throw SQL injection detection
*/
private logAndThrowSqlInjection;
/**
* Scan individual string value for SQL injection patterns
*/
private scanStringValue;
/**
* Check if a query is whitelisted
*/
private isWhitelisted;
/**
* Decode URL-encoded and other encoded values for better detection
*/
private decodeValue;
/**
* Check if base64 string might contain SQL injection
*/
private mightBeSqlInjectionBase64;
/**
* Check if string looks like base64
*/
private isBase64;
/**
* Determine if pattern represents high-risk SQL injection attempt
*/
private isHighRiskPattern;
/**
* Sanitize value for logging (remove sensitive content)
*/
private sanitizeLogValue;
/**
* Add custom pattern to detection
*/
addCustomPattern(pattern: RegExp): void;
/**
* Add query to whitelist
*/
addWhitelistedQuery(query: string): void;
/**
* Remove query from whitelist
*/
removeWhitelistedQuery(query: string): void;
/**
* Get detection statistics
*/
getStats(): Record;
/**
* Simple hash function for logging purposes
*/
private hashString;
/**
* Update configuration
*/
updateConfig(config: Partial): void;
}