query-rewrite
Pass
Audited by Gen Agent Trust Hub on Nov 19, 2026
Risk Level: SAFEINDIRECT_PROMPT_INJECTIONCOMMAND_EXECUTION
Full Analysis
- [Execution of User-Supplied SQL]: The skill is designed to ingest and execute SQL queries provided by the user to perform cost analysis and result verification. This is an intended part of the optimization workflow.
- [Input Sanitization Surface]: In Step 5 (Result Set Verification), user input is interpolated into T-SQL scripts and executed using
sp_executesql. The skill instructs the agent to double single quotes for escaping, which is a standard mitigation. However, the reliance on the LLM to correctly handle this escaping represents a potential indirect prompt injection or SQL injection surface. - [Sensitive Database Metadata Access]: The skill queries system catalogs (e.g.,
sys.foreign_keys,sys.tables) to retrieve schema information. This information gathering is necessary for Strategy 7 (PK/FK Join Elimination) but exposes the database structure to the agent. - [Intentional Command Execution]: The skill utilizes tools such as the
microsoft-sql-adminMCP server orsqlcmdto interact with the database. These are powerful capabilities used here for query tuning, but they require appropriate database-level permissions and user oversight. - [Verification Boundary]: The skill correctly implements a security boundary by requiring explicit user authorization before performing result set verification, which involves executing the queries on the live database environment.
Audit Metadata