Schemagate: Enhancing Text-to-SQL Security via Context-Aware Schema Filtering

Developer Ashish Sinha has introduced Schemagate, an open-source tool designed to improve security and efficiency in text-to-SQL applications. Most current LLM-based SQL stacks provide the entire database schema to the model, performing access checks only after a query is generated. Schemagate shifts this paradigm by filtering the schema based on the caller's identity before the model sees it. By restricting the visible tables to only those the user is authorized to access, the tool reduces prompt token usage and prevents unauthorized data exposure. The library supports major databases including PostgreSQL, SQLite, Oracle, SQL Server, and MySQL. It also features integrations for LangChain and the Model Context Protocol (MCP). While the author acknowledges that retrieval performance is still evolving, Schemagate offers a practical approach to implementing role-based access control directly within the LLM prompt engineering pipeline.
This is a summary. Read the full article at the original source:
Dev.toRelated stories
I made my agent prove every quote against the source document
Developer Chanadev has introduced TSB Oracle, an AI agent designed to improve the accuracy of information retrieval regarding automotive service bulle…
Jev is a very good classifier wearing a frontier model's coat
The recently launched AI tool 'Jev' is being marketed as a revolutionary frontier model, but technical analysis suggests it is primarily a highly effi…
From smartphone to sovereign agent: How native on-device intelligence reshapes the personal computing device
This article explores the transition of smartphones from cloud-dependent terminals to sovereign agents powered by native on-device intelligence. The a…



