A software security skill that integrates with Project CodeGuard to help AI coding agents write secure code and prevent common vulnerabilities. Use this skill when writing, reviewing, or modifying code to ensure secure-by-default practices are followed.
rule_id: codeguard-0-input-validation-injection
Ensure untrusted input is validated and never interpreted as code. Prevent injection across SQL, LDAP, OS commands, templating, and JavaScript runtime object graphs.
Example (Java PreparedStatement):
String custname = request.getParameter("customerName");
String query = "SELECT account_balance FROM user_data WHERE user_name = ? ";
PreparedStatement pstmt = connection.prepareStatement( query );
pstmt.setString( 1, custname);
ResultSet results = pstmt.executeQuery( );SOQL and SOSL are query/search languages (no SQL-style DDL/DML). Data changes are performed via Apex DML or Database methods. Note: SOQL can lock rows via FOR UPDATE.
[SELECT Id FROM Account WHERE Name = :userInput] or FIND :term.Database.queryWithBinds(); for dynamic SOSL, use Search.query(). Allow‑list any dynamic identifiers. If concatenation is unavoidable, escape string values with String.escapeSingleQuotes().WITH USER_MODE or WITH SECURITY_ENFORCED (don't combine both). Enforce record sharing with with sharing or user-mode operations. Use Security.stripInaccessible() before DML.\ # + < > , ; " = and leading/trailing spaces* ( ) \ NULexec).-- to delimit arguments where supported to prevent option injection.Example (Java ProcessBuilder):
ProcessBuilder pb = new ProcessBuilder("TrustedCmd", "Arg1", "Arg2");
Map<String,String> env = pb.environment();
pb.directory(new File("TrustedDir"));
Process p = pb.start();new Set() or new Map() instead of using object literalsObject.create(null) or { __proto__: null } to avoid inherited prototypes.--disable-proto=delete as defense‑in‑depth.__proto__, constructor, prototype.Cache-Control: no-store on responses containing sensitive data; enforce HTTPS across data flows.tessl i cisco/software-security@1.2.2evals
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
rules