Authentication, query validation, policy enforcement, human-in-the-loop approvals, and complete audit trails.
The system uses a layered authentication model where user identity flows through every layer:
User → VS Code (Azure AD SSO) → Bearer token sent to Orchestration API → API validates token, extracts user identity → API uses service principal for downstream calls → Power BI / Snowflake enforce RLS / role-based access
Every generated query is validated before execution. The validator checks for:
| Check | Description | Action on Fail |
|---|---|---|
schema_whitelist | Query only references allowed tables/schemas | Block + explain |
no_mutations | No INSERT, UPDATE, DELETE, DROP, TRUNCATE | Block + explain |
row_limit | LIMIT/TOP clause enforced (max 10,000) | Auto-inject limit |
no_cross_join | Prevent accidental cartesian products | Block + explain |
cost_estimate | Estimated scan size below threshold | Warn + require approval |
Policies are defined as JSON rules and evaluated at runtime:
{
"name": "block-pii-tables",
"description": "Prevent access to PII-containing tables",
"condition": {
"tables_referenced": {
"contains_any": ["dim_patient", "dim_member_ssn"]
}
},
"action": "block",
"message": "Direct access to PII tables is not permitted. Use the anonymized views instead."
}
Different users see different data. Analysts get aggregated views, admins get detail-level access.
Queries exceeding estimated cost thresholds require explicit approval before execution.
Restrict heavy queries to off-peak hours. Lightweight queries run anytime.
Tables tagged as PHI, PII, or Confidential have additional access checks.
Certain operations require explicit user approval before proceeding:
// System detects a high-cost query ⚠️ "This query will scan ~2.4 TB. Estimated cost: $1.20." "Do you want to proceed?" [✅ Execute] [❌ Cancel] [📝 Modify] // User clicks Execute → query runs // User clicks Modify → prompt for refinement
Approval is required for:
Every interaction is logged with full context for compliance and debugging:
{
"timestamp": "2026-04-07T14:32:01Z",
"user": "jsmith@contoso.com",
"session_id": "sess_abc123",
"question": "Show PMPM by region for Q1",
"intent": "kpi_trend",
"source": "power_bi",
"query": "EVALUATE SUMMARIZECOLUMNS(...)",
"validation": "passed",
"rows_returned": 12,
"duration_ms": 340,
"status": "success"
}
Row-level security is enforced at the data layer, not in the application:
RLS roles defined in the semantic model. The service principal impersonates the user's identity so PBI enforces the correct filters automatically.
User identity mapped to Snowflake roles via the orchestration layer. Each role has specific warehouse, schema, and table grants.