Introducing Row-Level Security
We're excited to announce a major enhancement to Waii, the world's best text-to-SQL API: Row-Level Security (RLS). This feature is crucial for applications requiring fine-grained access control over data.
What is Row-Level Security?
Row-Level Security allows you to define which rows (and columns) individual users or groups of users can access. Waii intelligently injects these security rules during query execution, ensuring that users only see the data they're authorized to view.
How It Works
Waii's bespoke compiler handles the injection of security rules, making the process predictable and safe. This approach doesn't rely on LLMs for rule injection, ensuring consistency and reliability.
Example: Sales Data Access Control
Let's look at a practical example using a sales database with a sales_data table and a sales_rep table:
Base Query:
SELECT * FROM sales_data
Injected Restriction for a Sales Representative:
SELECT * FROM sales_data
WHERE rep_id IN (
SELECT id FROM sales_rep
WHERE name = '{user}'
)
Injected Restriction for a Regional Manager:
SELECT * FROM sales_data
WHERE rep_id IN (
SELECT id FROM sales_rep
WHERE region = (
SELECT region FROM sales_rep
WHERE name = '{user}'
)
)
In these examples, Waii automatically injects the appropriate subquery using patterns provided by the application, based on the user's role and permissions. The `{user}` template parameter is used to represent the current user's name.
Flexible Implementation
You can choose to have Waii:
1. Inject these rules during query execution
2. Generate modified queries for you to run independently
This flexibility allows you to integrate Row-Level Security seamlessly into your existing application.
Why It Matters
Row-Level Security is essential for:
- Ensuring data privacy and compliance
- Implementing multi-tenant architectures
- Customizing data access based on user roles or attributes
With Waii's Row-Level Security, you can confidently build applications that require sophisticated access control without compromising on performance or ease of use.
Upgrade to Waii 1.21 today and experience the power of intelligent, secure data access!