Skip to main content
AnomalyArmor uses an open-source SQL security layer called the Query Gateway to enforce strict access controls on every query we run against your database. This page explains how it works and how you can verify our security claims.

What is the Query Gateway?

The Query Gateway is a SQL validation layer that parses and validates every query before execution. It’s the enforcement mechanism behind our “metadata only” promise. Query execution flow through Gateway validation

Key Security Properties

Access Levels

The Query Gateway enforces three distinct permission tiers. AnomalyArmor uses different access levels depending on the operation:

What AnomalyArmor Uses

AnomalyArmor does not use full access level. We only query metadata (schema_only) and aggregate statistics (aggregates) for freshness monitoring.

Schema Only Mode

In schema_only mode, queries can only access system catalogs:

Aggregates Mode

In aggregates mode, queries can retrieve statistical information but never raw values:

Open Source Verification

The Query Gateway is fully open source under the Apache 2.0 license. Your security team can:
  1. Audit the code - Review exactly how queries are validated
  2. Run the test suite - 97+ tests covering security edge cases
  3. Verify our claims - See the exact rules enforced at each access level

GitHub Repository

View the source code, run tests, and verify our security implementation

Running the Tests Yourself

Technical Implementation

SQL Parsing

The gateway uses sqlglot to parse queries into an Abstract Syntax Tree (AST). This enables:
  • Dialect-aware parsing (PostgreSQL, MySQL, Databricks, ClickHouse, etc.)
  • Accurate identification of accessed tables and columns
  • Detection of nested queries and CTEs

Validation Process

Query validation process from parsing to allow/block decision

Supported Databases

The gateway supports all databases that AnomalyArmor connects to:
  • PostgreSQL
  • MySQL
  • Databricks
  • ClickHouse
  • Snowflake
  • SQL Server
  • BigQuery
  • Redshift

Audit Logging

Every query validation is logged with:
  • Query text
  • Access level applied
  • Allow/block decision
  • Rejection reason (if blocked)
  • Metadata (asset ID, user ID, timestamp)
These logs are available in your audit trail (Enterprise plans).

Common Questions

Can I run the Query Gateway myself?

The gateway is open source, but AnomalyArmor runs it as part of our managed service. Self-hosted deployments are available for Enterprise customers.

What happens if a query is blocked?

Blocked queries are logged and never reach your database. The discovery job reports an error, which our engineering team investigates.

Can the Query Gateway be bypassed?

No. All database queries from AnomalyArmor pass through the gateway. There is no code path that executes queries directly.

How do I verify AnomalyArmor is using the Query Gateway?

Check your database query logs: you will only see metadata queries (against system catalogs) and aggregate queries (COUNT, AVG, MIN, MAX). Never SELECT * or raw row reads. You can also review the open-source gateway code directly.

Security Overview

Full security documentation

Data Handling

What data we access and store