""" Input validation security tests (SECU-03). Tests cover: - SQL injection prevention (OWASP A01:2021) - XSS prevention (OWASP A03:2021) - Path traversal prevention - Command injection prevention - OWASP Top 10 API security vulnerabilities """ import pytest from fastapi.testclient import TestClient from sqlalchemy.orm import Session # OWASP-based exploit payloads SQL_INJECTION_PAYLOADS = [ "'; DROP TABLE users; --", "1' OR '1'='1", "admin'--", "'; EXEC xp_cmdshell('dir'); --", "1' UNION SELECT NULL, NULL, NULL--", "' OR 1=1#", "admin'/*", "' OR '1'='1'--", "1' AND 1=1--", "'; SELECT * FROM users WHERE '1'='1", "' UNION SELECT username, password FROM users--", "1'; EXEC master..xp_cmdshell 'dir';--", "'; INSERT INTO users VALUES ('hacker', 'password');--", "' OR EXISTS(SELECT * FROM users WHERE username='admin')--", "1' OR '1'='1' ORDER BY 1--", ] XSS_PAYLOADS = [ "", "", "javascript:alert('XSS')", "", "'>", "", "", "