Every data-access control eventually meets a query it can’t fully understand. A table nobody catalogued. A statement the parser chokes on. A client address with no known location. A user the directory has never heard of. What the control does next is the most important design choice it makes, and most tools make it quietly: when in doubt, let the query through and log a warning. This post explains why InsightAIShield makes the opposite choice, what exactly counts as “not sure”, how a refusal is explained to the person who ran the query, and how a team rolls out a fail-closed engine without blocking the business on its first morning.

In short

  • No policy means no data. A query no policy allows is blocked. So is a query on a table that isn’t in the catalogue, SQL that can’t be parsed, a rule with bad parameters, a location rule with an unknown location, a row filter whose user attribute is missing, and any error inside the engine.
  • A refusal carries its reason. The person sees which policy and which rule said no; the activity record keeps the original SQL, the reason and the context.
  • Monitor before you enforce. A policy in monitor mode records what it would have done and changes nothing, so the first weeks prove the policy on real traffic.
  • The strongest protection wins. When two rules protect one column: block, then tokenize, hash, redact, mask, skip.

Why “fail open” is the default almost everywhere

Failing open is tempting for a simple reason: a blocked query is visible and a leaked column is not. If a proxy refuses a report at eight in the morning, someone calls the help desk. If the same proxy waves through a query it couldn’t parse, nobody notices until an auditor reads the logs, and often not then. Teams under pressure to “not break anything” tune their controls toward silence.

The result is a control that protects the easy cases and leaves the hard ones open. And the hard cases are exactly where an attacker, or a curious insider, goes looking: an unusual SQL construct, a table added last week that the policy author never saw, a connection from somewhere the location rules don’t recognise. A control that steps aside whenever it is confused teaches people how to confuse it.

InsightAIShield’s policy engine was written as a port of an older rule catalogue, and the port is where its fail-closed behaviour comes from. Everywhere the older code let a query through on an error, the engine now refuses it. The internal-network bypass that waved through local addresses is gone. A timed-access rule outside its window denies instead of granting. A location rule compares each field (country, state, city, ZIP) to its own value.

What counts as “not sure”

The engine evaluates a query from the outside in: the location (the source), then the store (the table), then each field (the column). At every level it needs a positive answer to let the query continue. These are the situations in which it doesn’t have one, and what it does:

SituationWhat the engine doesWhat the person sees
No policy applies to this person on this sourceBlocksNo grant lets them read the table
The table isn’t in the estate’s catalogueBlocksThe object is unknown
The SQL can’t be parsedBlocksThe query couldn’t be evaluated
A rule’s parameters are invalidBlocksThe rule couldn’t be applied
A location rule applies and the client’s location is unknownBlocksOnly from these places; the location is unknown
A row filter needs a user attribute the directory doesn’t haveBlocksThe filter couldn’t be bound
Any error inside the engineBlocksFail-closed message with the error
A command that touches no data (SET, SHOW, BEGIN, COMMIT…)Allows and logsNothing: drivers keep working

The last row matters in practice. Database drivers send housekeeping statements on every connection: setting a search path, starting a transaction, asking for the server version. Those touch no data, so the engine lets them through and records them. Everything that reads or changes data needs a policy that says yes.

no

yes

no

yes

no

yes

unknown or no

yes

Query arrives
proxy, gateway or monitor

Parses?

Block
with the reason

Every table
in the catalogue?

A grant for this
person and command?

Location, time, IP
rules satisfied?

Field rules:
mask, redact, tokenize

Rewritten SQL runs
decision recorded

Every branch that isn’t a clear yes ends in a block, and every block carries its reason.

Three refusals on Northmere Bank

Northmere Bank is the fictional bank in InsightAIShield’s demo, with a core-banking PostgreSQL database, a cards platform on MySQL, a Snowflake warehouse and an S3 data lake. Three queries from its policy simulator show the engine saying no for three different reasons.

The location nobody could place

The warehouse policy, warehouse_analytics, lets analysts read customer analytics only from the United States. A fraud analyst runs a query against analytics.customer_360 from an address the geolocation lookup can’t place. An engine that fails open would treat “unknown” as “probably fine”. This one treats it as a location that doesn’t satisfy the rule.

The policy simulator refusing a warehouse query for a fraud analyst: the LOCATION_ACCESS rule of warehouse_analytics v1 denies because the client's location is unknown, and nothing reached the database.
Demo data A location rule with an unknown location denies. The rewritten side says plainly that nothing reached the database.

The delete nobody granted

An analyst with read access to customer data tries delete from login_events. Her policy, core_customer_pii, grants read on the core-banking source, and read never includes delete. There is no rule that forbids the delete; there is simply no grant that allows it, and that is enough.

The simulator blocking a delete from login_events: no grant lets the analyst delete from core_banking.northmere_core.login_events, policy core_customer_pii v1.
Demo data No grant, no command. The reason names the person, the command and the table.

The AI agent asking for SSNs

The customer support assistant is an AI agent with its own database role. Its policy, ai_agent_data, lets it read account details for one customer at a time, with the account number tokenized. When it asks for select ssn from customers, nothing in its policy covers that table, so the answer is no.

The simulator blocking select ssn from customers for the customer support assistant: no grant lets support-assistant read core_banking.northmere_core.customers, policy ai_agent_data v1.
Demo data An agent is a principal like any other. No grant on the table, no rows.

Through the PostgreSQL wire proxy the same refusal reaches the client as an ordinary database error, ERROR 42501 with the message “InsightAIShield blocked this query” and the reason. Applications already handle permission errors; they don’t need to learn a new failure mode, and an AI agent can’t mistake a refusal for an empty result.

When two rules disagree, the stronger one wins

Fail-closed also applies when policies overlap. A card number may be masked by one policy and tokenized by another; a column may be redacted for analysts and blocked for everyone outside a group. The engine doesn’t pick the first rule it finds or the most permissive one. It ranks the protections and applies the strongest:

block > tokenize > hash > redact > mask > skip.

A person who belongs to two groups gets the protection of the stricter one on each column, and a policy author adding a mask can’t accidentally weaken a block that another team wrote.

Rolling it out without stopping the business

The honest objection to fail-closed is the first day. Point a fail-closed engine at a busy database with half-written policies and it will refuse a great deal of legitimate work. The answer is not to fail open; it is to learn what the policies would do before they do it. InsightAIShield gives you three ways to do that.

A fail-closed rolloutFrom audit logs to enforcement on one source
1
Read the audit logs firstmonitor mode

Point a monitor source at pgaudit, Snowflake query history, Redshift logs or CloudTrail. Each statement is decided as if it had come through a proxy and recorded with what would have happened. Nothing is blocked: the query already ran.

2
Write policies in monitor modemode: monitor

A policy in monitor mode records its effects and never applies them. The activity view shows “Would block” next to the queries it would have refused.

3
Replay each draft on recorded activitysimulator

Before a version is proposed, the engine re-decides the last days of recorded queries with it and lists what would change.

4
Fix the gaps the replay findspolicy author

Missing grants and unknown tables show up as would-be blocks. Add the grant, or confirm the refusal is right.

5
Switch to enforce, with four eyessecond lead

Enforcing is a new version. A lead who neither wrote nor proposed it approves it.

6
Put the source behind the proxy or gatewayinline

Applications connect to the proxy’s address instead of the database’s, or call the query gateway through the SDK.

On Northmere’s estate both patterns run side by side. The lake is governed by lake_sensitive_monitor, a policy in monitor mode reading CloudTrail; the core-banking database sits behind the PostgreSQL proxy in enforce. The warehouse’s query history is read in monitor mode too, which is how the demo shows a query from Amsterdam that a location rule would have blocked, recorded as “Would block” without anyone being stopped.

FAIL OPEN Unknown means allowed

Gaps in the catalogue, the parser or the directory become gaps in protection. The log shows a warning nobody reads.

FAIL CLOSED Unknown means refused, with the reason

Gaps show up as refusals with a named cause on the first day of monitor mode, and are fixed before anything is enforced.

What a refusal looks like afterwards

A blocked query is not a dead end in the records. The activity view lists it with the person, the database user, the client address and its location, the enforcement point, the policy and the rule. A burst of refusals from one person within an hour is itself a detector in the anomaly engine, so a misconfigured application or someone probing the database shows up as a scored anomaly rather than a wall of log lines.

Refusals also feed the evidence. The PCI DSS audit-log control counts the blocked queries in the last days; SIEM exports carry each one as an event with its disposition, the original SQL and the reasons, so the security operations team sees the same thing the data team does.

Not sure is not yes.

A data-access control earns trust by being predictable at the edges. InsightAIShield refuses whatever it can’t positively allow, explains every refusal, and gives you monitor mode and replay so the first refusals you see are the ones you meant.

Where people stay in charge

  • Switching a policy from monitor to enforce is a new version, and a second lead approves it before it applies to a single query.
  • Every agent action is capped at L2, “ask first”: an agent prepares, and a person confirms, activates, revokes, sends or decides.
  • A policy version goes live only when a second lead, not the person who proposed it, approves it.
  • A revocation is proposed by one reviewer and approved by another; the REVOKE statement is kept on the record for your DBA to run.
  • Detokenizing needs a stated purpose, is recorded, and is capped per person per period.
  • SIEM batches and attestation requests are held until a person releases them.

Keep reading