-
Notifications
You must be signed in to change notification settings - Fork 1
Security Governance
hs-sql-agent keeps resource limits and SQL safety rules on the server. The Admin Panel can update the runtime policy without restarting the application, and the same rules apply to built-in and custom SQL tools.
Open Runtime > Security Policy in the Admin Panel. Reading the page requires /runtime/security.view; saving changes requires /runtime/security.edit.
| Setting | Default | Valid range | Enforcement |
|---|---|---|---|
| Maximum returned rows | 1,000 | 1-100,000 | Applies a server-side query limit |
| SQL timeout | 30 seconds | 1-600 | Applies to query and DML execution |
Require WHERE for UPDATE
|
Enabled | Boolean | Rejects unscoped updates |
Require WHERE for DELETE
|
Enabled | Boolean | Rejects unscoped deletes |
Allow full-table UPDATE
|
Disabled | Boolean | Must be enabled, with the WHERE requirement disabled, to permit an unscoped update |
Allow full-table DELETE
|
Disabled | Boolean | Must be enabled, with the WHERE requirement disabled, to permit an unscoped delete |
| Maximum affected DML rows | 100 | 1-1,000,000 | Rolls back a dry run that exceeds the limit |
| Default MCP-key requests | 120 | 1-1,000,000 | Default authenticated-key quota |
| MCP-key window | 60 seconds | 1-86,400 | Default authenticated-key window |
| Maximum concurrent SQL | 16 | 1-10,000 | Limits active built-in and custom SQL operations |
The Admin database is authoritative. Each process keeps a runtime copy for fast checks. In a distributed deployment, Redis publication provides immediate propagation and Admin database polling repairs missed notifications. See Distributed Deployment.
MCP request
-> pre-authentication IP rate limit
-> MCP key validation and tool/table restrictions
-> authenticated per-key rate limit
-> SQL concurrency lease
-> SQL parsing and validation
-> query/DML runtime policy
-> user database execution
-> structured audit event
The IP limit is startup configuration under RateLimiting. Authenticated-key defaults and SQL policies are runtime settings stored in the Admin database.
- The server applies
QueryMaxRowseven when a client omits a limit or requests a larger result. -
QueryTimeoutSecondsis passed to the database query executor. - Table whitelists and tool allowlists remain independent checks.
-
MaxConcurrentSqlcovers built-in tools and custom SQL tools.
DML guardrails run before and during the dry run:
- Parse and validate the statement.
- Reject an unscoped
UPDATEorDELETEunless the policy explicitly permits it. - Execute inside a transaction.
- Roll back and reject the operation if affected rows exceed
DmlMaxAffectedRows. - Roll back the dry run.
- Ask the human user through MCP Elicitation.
- Execute and commit only after explicit acceptance.
Human acceptance cannot override a server-side policy rejection. A client without Elicitation support cannot commit DML.
Every MCP key has one rate-limit mode:
| Mode | Behavior |
|---|---|
Inherit |
Uses KeyPermitLimit and KeyWindowSeconds from the runtime security policy |
Custom |
Uses that key's request and window overrides |
Unlimited |
Disables only the authenticated per-key request quota |
Unlimited does not disable the IP rate limit, SQL concurrency limit, query limit, timeout, DML safeguards, table whitelist, or tool permissions. A rejected request returns HTTP 429 with Retry-After.
Policy decisions and SQL outcomes are written as structured audit events. See Operations and Audit for investigation workflows and Access Management for key lifecycle and role permissions.
hs-sql-agent — GitHub | Apache License 2.0