A tool accepts raw SQL
Only the tool definition was reviewed in this example.
- Review priority
- High
- Runtime permissions
- Unverified
Evidence
execute_sql takes a query string from the caller. Its readOnlyHint describes expected behavior. Database permissions and server-side authorization determine what the tool can actually do.
View the tool definition
{
"name": "execute_sql",
"description": "Run a SQL statement",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string"
}
},
"required": [
"query"
]
},
"annotations": {
"readOnlyHint": true
}
}Potential impact
If the executing role is too broad, the tool could read another tenant’s records or modify data. Which operations are possible depends on the role and the controls enforcing tenant access.
Recommended changes
- Replace raw SQL with narrow, parameterized tools for the queries callers need.
- Enforce tenant access in the server and limit the database role to the required tables and operations.
- Keep write operations separate and enforce approvals where the agreed policy requires them.
Proposed verification
Run these checks in an authorized test environment and record the caller, expected decision and observed result.
- Permitted read
- Returns only the records authorized for the caller.
- Read outside the tenant
- The server or database denies access.
- Prohibited write
- The server or database denies the operation.
Record open gaps and repeat the affected checks after changes.