T09 · Insecure Skill Coding Practices
- Location
scripts/toolbox.py:657- Finding
Read-only SQL interface does not enforce read-only statements
- Content
View full analysis
dict[str, Any]: try: if not sql: return _error("sql parameter cannot be empty") prep = _prepare(client, instance_id=instance_id, database=database) if not prep["ok"]: return prep["error"] p, ctx = prep["params"], prep["ctx"] if not p["database"]: return _error("database parameter is missing", {"missing": ["database"]}, context=ctx) req = { "instance_id": p["instance_id"], "instance_type": p["instance_type"], "database": p["database"], "commands": sql, "time_out_seconds": 60, } result = client.dbw.execute_sql(req) ``` The displayed error strings have been translated into English; the executable control flow is unchanged. ### Technical Analysis The function is documented and presented to the Agent as a read-only interface, but it does not inspect or classify the supplied SQL. Any non-empty string is copied directly into the `commands` field and sent to the remote `ExecuteSQL` operation. Instructions in `SKILL.md` tell the Agent not to use this function for DML or DDL, but prompt-level guidance is not a security boundary. Direct Python callers, command-line callers, compromised prompts, or later changes to Agent behavior can bypass those instructions. The implementation does not reject: - `INSERT`, `UPDATE`, or `DELETE` - `CREATE`, `ALTER`, or `DROP` - Administrative statements - Multiple statements separated by delimiters - Statements obscured by comments or dialect-specific syntax Whether a particular destructive statement completes also depends on database ...[truncated 1124 chars]- Remediation
View remediation
