Query Enforcement
How Guardrail Layer validates, constrains, and controls every query before it reaches your database.
Execution as a Controlled Operation
In Guardrail Layer, database execution is never assumed to be safe. Every query is treated as untrusted input — regardless of its source.
Queries are evaluated for safety before correctness.
Validation Pipeline
Each query passes through a deterministic enforcement pipeline:
- Syntax validation
- Metadata awareness
- Role and context evaluation
- Policy enforcement
- Execution gating
Allowed Query Types
Guardrail Layer enforces strict rules around which query types are permitted.
Allowed by default, subject to policy
Restricted, optional
Restricted, optional
Disabled by default
Even allowed query types are constrained by role and context.
Column & Projection Enforcement
Queries are analyzed to determine exactly which columns are being accessed.
Enforcement includes:
- Denying restricted columns
- Removing unauthorized projections
- Replacing sensitive fields with redacted equivalents
Join Constraints
Joins significantly increase inference risk and are strictly controlled.
Guardrail Layer can:
- Allow joins only along approved relationships
- Deny joins across sensitivity boundaries
- Rewrite joins to safe subsets
Aggregation Controls
Aggregations are a common source of unintended data leakage.
Guardrail Layer enforces:
- Minimum group sizes
- Aggregate-only roles
- Limits on repeated aggregate queries
Execution Limits
Guardrail Layer enforces execution safety limits regardless of query intent.
- Row count caps
- Mandatory LIMIT clauses
- Timeout thresholds
- Execution cost ceilings
Query Outcomes
Every query results in a clear, explicit outcome:
Executed unchanged
Safely rewritten
Blocked with explanation
Deterministic Behavior
Guardrail Layer does not rely on probabilistic or heuristic enforcement.
The same query in the same context will always produce the same result.
Why This Matters
Enforcement is not about preventing errors — it's about preventing irreversible mistakes.
Guardrail Layer treats the database as a protected system, not a playground for prompt experimentation.