T09 · Insecure Skill Coding Practices
- Location
scripts/db.sh:124- Finding
Unvalidated identifiers and enum values permit SQL injection in generated output
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 } } ``` 2. Apply validation independently to table names, column names, index names, and every parsed field. 3. Parse enum definitions structurally and validate each member against an explicit character and length policy. Escape literals using database-native facilities rather than ad hoc `sed` substitutions. 4. Reject quote characters, semicolons, comments, newlines, control characters, and malformed field definitions. 5. Prefer database-native identifier-quoting APIs when integrating the generator into an application. 6. Clearly mark generated SQL as untrusted output requiring review, and never pipe it directly into a database client. 7. Add regression tests covering malicious backticks, double quotes, single quotes, semicolons, comments, newlines, and malformed enum definitions. 8. Execute reviewed migrations through a least-privileged database role that cannot access unrelated schemas or perform unnecessary destructive operations. ]]>
