(input: string)
| 112 | } |
| 113 | |
| 114 | export function detectSQLInjection(input: string): boolean { |
| 115 | const sqlPatterns = [ |
| 116 | /(\bor\b|\band\b).*[=<>]/i, |
| 117 | /union.*select/i, |
| 118 | /drop\s+table/i, |
| 119 | /insert\s+into/i, |
| 120 | /delete\s+from/i, |
| 121 | /update\s+.*\s+set/i, |
| 122 | /exec(\s|\()/i, |
| 123 | /script.*>/i, |
| 124 | /<.*script/i, |
| 125 | /javascript:/i, |
| 126 | /onerror\s*=/i, |
| 127 | /onload\s*=/i |
| 128 | ]; |
| 129 | |
| 130 | return sqlPatterns.some(pattern => pattern.test(input)); |
| 131 | } |
| 132 | |
| 133 | export function sanitizeInput(input: any): any { |
| 134 | if (typeof input === 'string') { |