SafetyCard Request a review

Chat2DB

Cross-platform DB client/SQL workspace with AI SQL generation over 40+ databases

github.com/OtterMind/Chat2DB · 2026-10-03 · dc2b80a

Defense-in-depth score

3.5 / 10

Chat2DB's AI assistant can query every database you have saved, using your full stored credentials, and the model chooses which one. Its best control is a hard refusal of write SQL: anything other than SELECT/SHOW/DESCRIBE is handed back for you to run yourself, and there is no setting to turn that off. The dominant risk is data exfiltration: content in your databases or uploaded files can steer the model, and the chat UI offers an unattended egress path. There are also no time, step, or query-timeout limits on an AI turn.

Safest setup

Chat2DB hands any AI-written SQL other than SELECT, SHOW or DESCRIBE back to you to run by hand, with no setting to turn that off, and keeps chat history per session. Beyond that the defaults are thin: the assistant can use every saved connection with its full stored credential, and nothing limits a turn's time or queries. The safest setup narrows what the database accounts can do and builds containment around the app.

SetupHowWhat it gives you
A read-only database accountSave each connection you use with AI under a dedicated database account that can only readThe database itself refuses writes, whatever SQL reaches it C1
A replica for AI workPoint the connections you use with AI at a read replica or a copy rather than the primaryModel-written SQL runs away from the live data your applications depend on C4
A server-side statement timeoutSet a statement timeout for that database account on the database serverA long or runaway query ends on its own, even after you stop the response C10
Only the connections neededUse AI chat in an install whose saved connections hold only the datasources the task needsThe assistant can reach only those databases, whichever one the model picks C1
The MCP server offKeep the default enableMcp setting offAI tools are used only from the chat in front of you, where every call is traced C9
A response length limitSet Max Tokens (maxTokens) in the AI model configurationEach model response stops at a length you chose C10
Its own VM with limited egressRun Chat2DB in a VM or separate account whose network reaches only your model provider and the databases you useA narrow path for query results to leave, and your other files and keys stay out of reach C5

Approving with confidence

  • Read each statement the assistant hands back and run it yourself only when it matches what you asked for.
  • Queries run without a prompt, so check which datasource each tool call in the chat trace names.

Handling data

  • Chat history keeps tool results, query rows included, as plain JSON on disk; store it like the data it holds and delete sessions you no longer need.
  • Query results the assistant reads go to your model provider without redaction, so pick a provider your data may go to.

Key gaps (1)

  1. JDBC drivers run in-process with every decrypted datasource password and AI API key, and the MySQL drivers are downloaded automatically from the vendor CDN at startup without integrity verification. C7 · Third-party extensions

Criteria

C1 Identity & least privilege

0.05 / 1.00

The AI assistant runs every database tool with the full stored credential of whichever datasource it chooses. Although the chat request carries the datasource the user selected, a model-supplied datasource id overrides it, and list_all_datasources hands the model every saved connection (up to 200, including production-tagged ones). There is no dedicated or read-only identity for AI work and no authorization check between the model's choice and the credential; the only thing that narrows damage is the separate non-query SQL refusal scored under tool scoping.

C2 Approval gates

0.63 / 1.00

Chat2DB does not let the AI run write SQL itself. Every execute_sql call is parsed into statement types; anything other than SELECT/SHOW/DESCRIBE is refused and handed back to the user to run manually in the SQL console, and the policy hook that could allow non-query execution is hard-wired to false with no setting to change it. The exact SQL the model attempted is shown in the chat trace, so the human runs exactly what they see. The gap is in what counts as safe: statements classified as queries run unattended, and the classification is not a strict boundary.

C3 Tool & action scoping

0.57 / 1.00

The six AI tools are narrow wrappers with typed parameters, bounded page sizes (500 rows max, 50 rows shown to the model) and a 20-table cap on schema requests, and execute_sql is filtered by a dialect-aware SQL parser that only lets query-type statements run. But execute_sql still accepts arbitrary SQL text, the read-only check is a statement-type classification rather than a read-only connection, and no tool validates which datasource or database the model points it at. The default tool set is effectively read-only, which is the strongest part of this design.

C4 Code-execution isolation

0.05 / 1.00

The model-generated code in Chat2DB is SQL, and it runs directly on the user's real databases through the normal JDBC connection with the stored credential. There is no isolation boundary: no read-only connection or transaction, no rollback wrapper, no sandbox database, and no query timeout. The statement-type filter (credited under tool scoping) is the only thing standing between model SQL and the database.

C5 Untrusted input blast radius

0.42 / 1.00

The assistant reads plenty of content its user did not write: database rows, table and column comments, DDL, and uploaded files, all of which enter the conversation with the same standing as the user's request (uploaded files are even framed as 'evidence provided by the user'). Nothing tracks that taint. What limits a hijack is that writes are always refused regardless of source. Data exfiltration is not limited: the chat UI offers an unattended egress path.

C6 Memory, context & configuration integrity

0.68 / 1.00

Chat2DB has no long-term memory, retrieval store, or auto-loaded instruction files. The only persistence that feeds back into the model is the chat history of the current session: the last five rounds of user and assistant text are re-sent on each turn, loaded only for the session the user owns. Poisoned content can therefore persist within a conversation but not spread to new ones, and the user can delete sessions.

C7 Third-party extensions

0.23 / 1.00

The AI layer itself loads no plugins or MCP servers in this release; the third-party code that runs alongside it is JDBC drivers, which execute inside the same JVM that holds every decrypted credential. Built-in drivers are fetched by version-pinned file name from the vendor's CDN with no checksum, and the MySQL drivers are pre-downloaded automatically at startup. Custom drivers are uploaded by the operator, which the security policy treats as trusted.

C8 Secrets & sensitive-data protection

0.33 / 1.00

Stored datasource passwords and AI API keys are encrypted at rest with AES-256-GCM using a per-installation key, and the main AI request path logs only content-free summaries with masked API keys. Elsewhere protection is thin: the log-redaction controls do not cover every path, chat transcripts with query results are stored as plain JSON, and nothing redacts sensitive data from query results before they go to the model provider. Usage telemetry is on by default but content-free.

C9 Audit & traceability

0.45 / 1.00

Each chat turn's tool calls (name, exact arguments, timestamp) and tool results are streamed to the UI and saved with the assistant's message in the local chat history, and every executed AI query is also written to the SQL operation log tagged AI_TOOL. That gives a usable local record, but it is saved only when the stream completes normally, operation logging is asynchronous and best-effort, refused statements and list calls are absent from the operation log, MCP calls are tagged the same as in-app AI calls, and the client can turn history persistence off per request.

C10 Limits & kill switch

0.07 / 1.00

There are no hard limits on an AI turn. No tool-call round cap is configured for Spring AI's internal tool loop, the HTTP stream emitter has no timeout, AI-issued SQL has no query timeout, and output token limits apply only if the user sets them in the model config. Stopping a response closes the stream and disposes the subscription, but a query already running on the database continues.