Problem Statement
The prediction API currently accepts text of unlimited length, making it vulnerable to Denial-of-Service (DoS) attacks. An attacker could send a massive text payload (e.g., 10MB of random characters) causing the ML model to consume excessive CPU/memory, potentially crashing the server.
Proposed Solution
Implement strict input validation for all API endpoints:
Maximum text length: 5000 characters
Maximum request size: 1MB
Rate limiting per IP
Early validation before expensive ML operations
Problem Statement
The prediction API currently accepts text of unlimited length, making it vulnerable to Denial-of-Service (DoS) attacks. An attacker could send a massive text payload (e.g., 10MB of random characters) causing the ML model to consume excessive CPU/memory, potentially crashing the server.
Proposed Solution
Implement strict input validation for all API endpoints:
Maximum text length: 5000 characters
Maximum request size: 1MB
Rate limiting per IP
Early validation before expensive ML operations