# DEB-203: Query validation layer to validate the queries generated by the agent

> **Jira:** [DEB-203](https://divami.atlassian.net/browse/DEB-203)  
> **Source Report:** [20260315.md](../../reports/jira/20260315.md)

- **Status:** Start
- **Assignee:** Unassigned
- **Priority:** Medium
- **Created:** 2026-02-20T15:47:19.612+0530
- **Updated:** 2026-02-20T15:47:19.799+0530

**Description:**

*No description provided.*

**Architecture Diagram:**

```mermaid
flowchart TD
    A[Agent generates SQL / query] --> B[Query Validation Layer]
    B --> C{Validation checks}
    C --> D[Syntax validation]
    C --> E[Safety check<br/>no DROP/DELETE/INSERT]
    C --> F[RBAC scope check<br/>user can access tables]
    D & E & F --> G{All checks passed?}
    G -->|Yes| H[Execute query on data source]
    G -->|No| I[Reject with validation error]
    I --> J[Agent re-generates safe query]
```
