LLM-generated SQL can be correct yet leak data: separating query validity from authorization
awsamanai · reddit · 2026-09-14
A Reddit post highlights a key gap in NL2SQL systems: a syntactically correct query isn't necessarily an authorized one. In multi-tenant apps, an LLM can generate valid SQL that omits the tenant-restriction condition, exposing other tenants' data.
The proposed architecture inserts a structured intermediate layer: natural language → structured query → validation and policy checks → database execution, with the app independently enforcing tenant scope and field/operation policies, and asking for clarification on ambiguity. The author says the pattern works in production and open-sourced it as queryforge.
More from coding & agent
- kunchenguid releases new video on high-throughput multi-tasking agentic engineering — JohnAlexander · 2026-09-14
- Agent observability is a distraction: tool-call success isn't outcome correctness — Gallegos_Daniel · 2026-09-14
- Agent engineering lessons: the model is the smallest, most swappable part — alex_verem · 2026-09-14
- Running Qwen 27B on 2x P40s: parallel agents wreck KV cache, seeking a serial agent harness — Jumpy-Operation-4615 · 2026-09-14
- Runway launches MCP: generate video directly in ChatGPT, Claude and Cursor — tlakomy · 2026-09-14
- Google open-sources ARTEMIS, an Android automation agent — kunalpuri · 2026-09-14