AI-generated code contains 2-6x more security vulnerabilities than human code. Guard against these:
- No hardcoded secrets. Never embed API keys, passwords, tokens, or credentials in source code. Use environment variables or secret managers.
- No OS command construction from user input. Use parameterized APIs instead of string-concatenated shell commands.
- No debug artifacts in committed code. Remove all
System.out.println,printStackTrace,console.logdebugging, andprint()statements before finalizing. Use proper logging frameworks. - No cleartext sensitive data. Never log, transmit, or store passwords, tokens, or PII in plaintext.