Two things happened at Northmere Bank, a fictional bank, in the small hours of the same weekend. Early on Saturday a card-operations analyst ran two queries against the cards database at 02:14 and 02:19 and pulled 140,040 card rows. On Sunday morning at 03:41 a database administrator account that had not been used for 44 days connected from Romania and read every customer’s SSN and date of birth. Neither query was refused: both people held the grants. This post walks through how InsightAIShield noticed them anyway, how it scored each one, what its agents prepared, and who decided what happened next.

In short

  • Every query is recorded. The proxies, the query gateway and the monitor sources write one activity record per statement: who, from where, which objects and data classes, how many rows, and what the policy did.
  • Each person is compared with their own normal. A 30-day baseline per principal: queries and rows per active day, the 95th percentile of rows per query, the hours they work, the objects they read and the countries they connect from.
  • Detectors are code, and every point has its reason. Bulk read, off-hours, dormant account, new object, new country, a burst of blocked queries and sensitive data in AI prompts. The score is the sum, capped at 100.
  • Agents prepare, people decide. The anomaly investigator prepares an incident or a false-positive note; the incident writer runs the severity engine. A person opens, closes and decides.

Why the policy let both queries through

It is worth being clear about what a data policy can and cannot know. Devon Price works in card operations and belongs to the cards-ops group. The pci_cardholder_data policy grants that group read access to the cards database, masks card numbers to their last four digits, makes the card security code unreadable and forbids destructive commands. Devon’s two queries were exactly what the grant allows, and the engine rewrote them so the card numbers came back masked. From the policy’s point of view the queries were correct.

Tom Becker is a database administrator in the dba group, covered by the dba_operations policy. His query read customer_id, full_name, ssn, date_of_birth, street_address from the customers table, the policy allowed it as written, and 2,000 rows came back in clear. A DBA reading the customers table is not, on its own, wrong.

What makes both events worth a person’s attention is context the policy does not hold: how this person normally behaves. That is the job of the activity baselines and the detectors.

The activity record for Tom Becker's 03:41 query: the original SQL ran as written, allowed by the dba_operations policy grant, with the context panel showing the client in Bucharest, Romania, the pg_core_proxy enforcement point, 2,000 rows, the data classes address, date of birth, person name and SSN, and an anomaly score of 100.
Demo data The 03:41 query as recorded by the Postgres proxy: allowed by the grant, and scored 100 by the detectors.

A baseline per person, not per bank

A bank-wide threshold (“alert on any query over 50,000 rows”) fires all night on the card ETL service and never on the analyst who normally reads ten rows and suddenly reads ten thousand. So InsightAIShield keeps a baseline for each principal, people, service accounts and AI agents alike, built from the activity records over the previous 30 days:

  • queries per active day and rows per active day;
  • the 95th percentile of rows returned per query;
  • the hours of the day they are active, in the bank’s time zone;
  • the objects they read and the data classes in them;
  • the countries they connect from.

Devon’s baseline says 13.5 queries a day, about 830 rows a day, a 95th percentile of 115 rows per query, work between roughly 08:00 and 17:00, the three card tables, and the United States. Tom’s says nothing at all: he had no activity in the window, which is itself the point.

open

close

Activity records
proxy, gateway, monitor

Baseline per principal
last 30 days

Detectors
each adds points with a reason

Score, capped at 100
critical, high, medium, low

Anomaly
open

Anomaly investigator
prepares

A person

Incident

False positive
with the reason

From records to a decision: the detectors score, the agent prepares, a person decides.

The detectors, and the points they add

Each detector is a few lines of code that compare one query with its principal’s baseline and return points and a sentence. Nothing is learned or hidden; a security analyst can read why a score is what it is.

DetectorFires whenPoints
Bulk reada query returns at least 5,000 rows and at least ten times the principal’s 95th percentile45 with sensitive data, 30 without
Off-hourssensitive data is read in an hour with no activity in the baseline (two hours either side)25
Dormant accounta principal silent for 21 days or more becomes active40 if privileged, 25 otherwise
New objectthe first read of a sensitive object this principal has never touched15
New countrya connection from a country this principal has never used25
Blocked burst5 or more blocked queries within an hour35
AI sensitive promptan AI agent’s prompts carried identifiers the gateway had to mask or block55 for SSNs or cards, 35 otherwise

Where a principal has no usable history, fewer than three active days, the detectors fall back to absolute tests: 1,000 or more sensitive rows is a bulk read worth 30, sensitive data read between midnight and 06:00 is off-hours worth 20, and a country different from the directory’s home country is worth 25. The severity bands are fixed: 80 and above is critical, 60 high, 35 medium.

Devon’s export: high, but contained

Devon’s first query, select card_id, pan, holder_name, expiry from card where status = 'active', returned 48,210 rows at 02:14. His 95th percentile is 115, so the bulk-read detector fired with sensitive data in play: 45 points. 02:14 is an hour with no activity in his 20 active days: off-hours, 25 points. Total 70, high. Five minutes later a second query read the authorization table for the last 30 days, 91,830 rows, and joined the same anomaly.

The anomaly page for Devon Price's bulk read: high, score 70, with the reasons (48,210 rows against a 95th percentile of 115, card data read at 02:14 New York time, an hour with no activity in 20 active days), his baseline of 13.5 queries a day, an hours chart with the baseline in grey and the two events in red, and both queries masked by policy.
Demo data The bulk read scored against Devon’s own baseline. Both queries were masked by the cardholder-data policy.

The anomaly investigator agent worked it from the records and prepared a decision: open an incident. It listed what it found, the detectors’ reasons, the baseline, and the incident severity engine’s result. That engine is separate from the detectors and scores the incident, not the query: restricted data read (card numbers) is 30 points, 140,040 rows is 30, off-hours is 10. But every query was masked by policy, so no card number left in clear, and the engine credits containment with minus 25. The preparation reads: severity engine: 45 points, medium; contained by policy.

That is the right shape for a person to decide on. The export was large and odd, so somebody should ask Devon why. It was also harmless in the worst sense, because masking did its job. In the demo the preparation waits on the Prepared page with three buttons: Accept, Reject and Ask.

Tom’s login: critical, and not contained

Tom’s anomaly scored 100, the ceiling. The reasons, exactly as the screen shows them: silent for 44 days before this, a privileged account (dormant account, 40 points); read 2,000 rows of date of birth and SSN with no history to compare against (bulk read without a baseline, 30); connected from Romania while the directory places him in the United States (new country, 25); read date of birth and SSN at 03:41, outside the bank’s working hours (off-hours without a baseline, 20). The sum is 115 and the score caps at 100.

The dormant-account anomaly for Tom Becker: critical, score 100, investigating, with four reasons, his directory details (database engineering, dba group, privileged), an hours chart showing the 03:00 events, and a baseline panel saying no history to compare against.
Demo data The dormant account: every point with its reason, and a baseline panel that says there was nothing to compare with.

Here the policy rewrote nothing: the SSNs came back in clear. So when a person opened the incident, INC-2026-00001, the severity engine gave a very different answer. Restricted data read (bank account and SSN), 30. Volume, 5,000 rows across his two queries, 10. Off-hours, 10. Privileged account, 10. Dormant account, 15. New country, 15. No containment credit. 90 points: critical.

Incident INC-2026-00001 in the investigation stage, critical with 90 points: a severity table with each factor, its points and why (data sensitivity 30, volume 10, off-hours 10, privileged account 10, dormant account 15, new country 15, AI agent 0, contained by policy 0), the incident facts, and the notification obligations to assess under HIPAA, GDPR Article 33 and US state breach-notification laws.
Demo data INC-2026-00001: the severity engine’s factors, and the obligations a person must assess.

The engine also lists notification obligations to assess, from the data classes involved: the HIPAA Breach Notification Rule, whether GDPR Article 33 and its 72-hour notification applies, and the US state breach-notification laws that cover SSNs. These are pointers for the people who decide, never a legal conclusion.

What the agents prepare, and what they never do

INC-2026-00001, from anomaly to decisionWho does each step in the demo
1
The detectors score the querycode

Four reasons, 100 points, critical. The anomaly is open.

2
The anomaly investigator preparesagent, L2

An incident to open, with the reasons, the baseline and the records behind it.

3
A person opens the incidentAvery Brooks, owner

The anomaly moves to investigating and links to the incident.

4
The incident writer preparesagent, L2

The severity engine’s factors, a summary, and a request asking Tom to explain the access. The request is held.

5
A person sends the requesta lead

Tom answers through a link that needs no sign-in; his answer joins the record.

6
A person decidesa lead, four eyes

A critical incident is referred to a lead who did not submit it. The decision record keeps every control’s outcome.

Every agent action is capped at L2, “ask first”. The investigator can prepare an incident; it cannot open one. The incident writer can draft a request to the account holder; it cannot send it. Neither agent invents a time, a row count, a table or an intent: they report what the records show, and in the demo, with the model switched off, they run on their rules and say so.

The false positive that stays on the record

Not every anomaly is an incident. On Sunday morning Lena Okafor, an analyst, ran a series of statements the policy refused: a drop table, a grant select on customers to public, a copy customers to stdout, and several deletes. Six blocked queries within an hour fired the blocked-burst detector at 35 points, medium. A person reviewed the six statements and closed the anomaly as a false positive. It stays in the list with its decision record, which is what an auditor reviewing PCI DSS requirement 10.4.1 will want to see: anomalies reviewed, and the reasoning kept.

The anomalies list with seven entries: the dormant account at 100 critical and investigating, Devon Price's bulk read at 70 high, the loan-copilot AI agent at 55 medium, Lena Okafor's burst of blocked queries at 35 medium marked false positive, and a 1,102,877-row read by Mara Quinn at 30 low.
Demo data The week’s anomalies, worst first, each with its status and its link to an incident.

Closing the gap the policy can

The detectors find what a policy allowed but a person would question. Some of what they find is better closed with policy. Northmere’s card exports belong in the overnight batch window. A lead has proposed cards_export_window for the groups that run them: a time window of 01:00 to 03:00 New York time on the card table, and a cap of 50,000 rows per query. It is proposed, not active, because a second lead has to approve it: the person who proposed a version can never activate it.

For Tom’s case the useful follow-up is the access review, where his unused grants show up as candidates to revoke. That is the subject of the next post in this series.

A policy decides what a person may read. A baseline notices when they read it strangely.

Both matter, and neither replaces a person. InsightAIShield keeps every query’s record, scores it against the principal’s own history with points anyone can add up, and prepares the incident. A person opens it, a lead decides it, and the reasons stay on the record.

Where people stay in charge

  • The anomaly investigator prepares an incident or a false-positive note; a person opens the incident, closes the anomaly or marks it a false positive.
  • 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