Data classification for databases, built to drive masking

Sensitive data discovery and classification for your databases. The Data Discovery Satellite labels columns with regex on their paths or AI prompts on sampled values, and the Connector masks or blocks by label for every person, BI tool and AI agent.

data inventory · prod-postgresexample
# Data Discovery Satellite, scan every 12 hours
regex   app.public.customers.email      email_address
prompt  app.billing.accounts.acct_no    bank_account_number
prompt  app.public.patients.ref_id      medical_record_number
locked  app.public.users.dob            date_of_birth

The problem

Why do hand-kept column lists fall behind?

Plenty of data classification tools are built around an inventory and a report of where PII lives, and a masking rule that names tables and columns covers the schema as it was when someone wrote it. A migration adds customers.tax_id, or a team copies a table into the warehouse, and engineers, dashboards and AI agents can query the new column that afternoon.

  1. Column lists maintained by hand

    The rule lists the columns someone reviewed. The column added by this morning's migration isn't on it.

  2. Tables copied into the warehouse

    A copy keeps the values and loses the review, so the same SSNs come back from a schema nobody listed.

  3. Agents querying tables nobody reviewed

    A coding agent with database access can run SELECT * on a table that was never labelled.

today · no policy on the pathexample
01
maya · psqlSELECT tax_id FROM customersALLOWED
02
analyst · snowflakeSELECT ssn FROM staging.users_copyALLOWED
03
claude-code · psqlSELECT * FROM app.public.patientsALLOWED

# No label yet, so no mask: all three go through. Discovery on a schedule and policies that target labels pick the column up at the next scan.

Definition

Data classification tools for databases and AI agents

Data classification toolsnoun

Data classification tools find sensitive data and tag it with a type, such as an email address or a card number, or a level, such as confidential, so other controls can act on the tag.
  • Formal classifies structured data

    Database columns, plus MongoDB documents by sampling. Each label it assigns is an input to the policies that decide what a query returns.

  • An inventory report goes stale

    A report of where PII lives is useful in an audit, and it starts going stale with the next migration.

  • We put classification next to the proxy

    The Connector already carries database traffic, so the question is operational: when a query returns app.public.customers.ssn, which label does that column carry, and what does policy say this reader gets back? It’s one half of data security for AI, and masking is the other. Our database security guide covers the controls around both.

How it works

How data classification works with Formal

  1. Step 1 of 4

    Deploy the Data Discovery Satellite

    Create a Satellite in the Control Plane and run the container on ECS, Kubernetes or Docker with its API token, from AWS ECR or GCP Artifact Registry.

    YOUR INFRASTRUCTUREexample
    • Satellite created in the Control Plane✓
    • Container running with its API token✓
    • Image from AWS ECR or GCP Artifact Registry✓
  2. Step 2 of 4

    Schedule discovery per resource

    Pick the native user discovery connects as, a frequency and a deletion policy. For prompt labels, give that user SELECT on the scanned tables and the Satellite access to Bedrock.

    DISCOVERY · PROD-POSTGRESexample
    • every 12 hoursSCHEDULE
    • pg_discovery with SELECTNATIVE USER
    • bedrock:InvokeModel on Claude HaikuPROMPT LABELS
  3. Step 3 of 4

    Review and lock labels

    Check the results in Data Inventory, add regex or prompt labels for your own data types, and lock the columns you labelled yourself.

    DATA INVENTORYexample
    • app.billing.accounts.acct_no · bank_account_numberREVIEW
    • app.public.patients.ref_id · medical_record_numberREVIEW
    • app.public.users.dob · date_of_birth, lockedAPPROVED
  4. Step 4 of 4

    Write policies on labels

    Reference the label in a response policy, run it in dry-run against real traffic, then set it to Active.

    POLICY · MASK EMAIL_ADDRESSexample
    • dry-run: SELECT * FROM customersDRY RUN
    • active: SELECT * FROM customersMASKED
    • active: SELECT created_at FROM customersALLOWED

Discovery

Sensitive data discovery on a schedule

You can’t label what you haven’t listed. The Data Discovery Satellite is a container you run next to your Connectors.

Runs in your infrastructure

On ECS, Kubernetes or Docker, pulled from AWS ECR or GCP Artifact Registry.

Logs in as a native user

It catalogs databases, schemas, tables, views and columns with their data types.

A schedule per resource

Every 6, 12, 18 or 24 hours, or a cron expression.

A deletion policy

Schemas that vanish between scans are either marked for deletion or removed.

Schema changes tracked

A column added by this morning’s migration shows up in the inventory, already labelled, after the next scan, and nobody had to file a ticket to get it reviewed.

Which engines? See the release notes and the FAQ below.

Built-in labels

PII data classification with more than 50 built-in labels

Formal ships more than 50 built-in labels for sensitive data classification, and you reference each one in policies by its identifier. They’re grouped by category in the data inventory docs. What NIST SP 800-122 calls PII spans most of the first three rows.

  • Personal and contact data

    name, date_of_birth, email_address, phone_number

    PII
  • Location

    street_address, zip_code, geocode

    PII
  • Government identifiers

    social_security_number, passport_number, driver_identification_number

    PII
  • Healthcare

    medical_record_number, health_plan_beneficiary_id, medical_claim_number

    PHI
  • Financial

    credit_card_number, credit_card_cvv, bank_account_number, international_bank_account_number

    PCI DSS cardholder data
  • Employment

    employee_identification_number, individual_compensation

    Built-in
  • Vehicles and devices

    license_plate_number, device_serial_number

    Built-in
  • Network

    ip_address, mac_address

    Built-in
  • Credentials

    username, password

    Built-in

The built-ins are prompt labels, so they classify automatically only once the Bedrock backend below is set up. They’re editable: rewrite a built-in’s prompt or delete the ones you’ll never use in the same Labels screen where you create your own. Custom labels cover data types specific to you, such as an internal customer ID, with a regex or a prompt matcher. Tags are different again: discovery never assigns them, you add them for team, environment or compliance scope (finance, pci), and policies read them next to the label as col["tags"].

Classifiers

How does AI data classification with prompt labels work?

Discovery runs two kinds of matcher in a fixed order. Regex matchers test each column’s inventory path, database.schema.table.column, and never read a row: (^|\.)email$ matches app.public.customers.email and warehouse.staging.users.contact_email. Prompt matchers take what regex left: a sentence such as “Columns containing personal email addresses”, judged on the column’s name, its type and up to 10 sampled values. The classifier never sees the whole table, so a column whose sampled rows are empty or unusual can come back with the wrong label, or none. The Satellite calls Amazon Bedrock directly with its own AWS credentials, for example an ECS task role allowed bedrock:InvokeModel on the Claude Haiku inference profile in your account and region (prompt classification backends).

Regex labelsPrompt labels
ReadsThe column pathColumn name, data type and up to 10 sampled values
NeedsThe Data Discovery Satellite: no LLM, no extra database permissionThe Satellite, Amazon Bedrock and a native user with SELECT
RunsFirst, on every columnOn columns no regex matched
If sampling failsStill appliesSkipped for that table
Where the data goesNowhere: no rows are readA model endpoint in your AWS account, under your IAM policy
We'd use it forThe naming conventions you controlThe columns called ref_id or misc2

Label locking

Keep the labels you set

Some labels you’ll want to set yourself. Hand-set labels meet the scheduler on the next scan, so lock the ones you mean to keep.

  1. Set the label

    Pick one from Data Inventory, write it with the API, or declare it in Terraform with formal_inventory_object_data_label_link; the label definitions are a formal_data_label resource (Terraform docs).

  2. Turn on Lock Label

    Discovery re-runs matchers every time and may relabel any column that isn’t locked, so a correction you don’t lock can be overwritten. With Lock Label on, scans keep your label, and you can still change it by hand or in Terraform (label locking).

  3. Wait for the next scan after a matcher edit

    Editing a matcher changes nothing until the next scan.

  4. Remember what a lock protects

    Locking protects a label that exists. An empty column gets labelled at the next scan whatever its lock state.

Policy

From label to masking policy

A label does nothing until a policy reads it. Response policies see each returned column’s label as data_label, so a rule can target the label instead of a list of tables. This policy from the policy examples masks the username part of every column labelled email_address.

  • Masking follows column lineage, so an email column pulled in by SELECT * or a join is still caught
  • When discovery labels a new email column, this policy covers it from that scan on
  • Six masking types, keyed on the Formal user, their groups or the end user behind a BI tool, across Postgres, MySQL, MariaDB, Redshift, Snowflake, BigQuery, MongoDB fields and CSV objects in S3: see data masking software
  • Run any new policy in dry-run before you set it to Active
Masking types and the mask action ›
mask_emails.regorego
package formal.v2

import future.keywords.if

# Mask emails
response := {
  "action": "mask",
  "type": "redact.partial",
  "sub_type": "email_mask_username",
  "columns": columns,
  "typesafe_fallback": "fallback_to_default"
} if {
  columns := [column |
    column := input.row[_]
    column.data_label == "email_address"
  ]
  columns != []
}

On the access path

Why run data classification software on the access path?

Data classification software on the access path turns a label into a decision on every query. Formal’s Connector already proxies the queries that people, BI tools and agents send to your databases, so a column labelled at the last scan is masked in the next result by any policy that targets its label, and the log of that query records which labelled columns came back and to whom.

Enforcement

Mask every column that carries a label

A response policy names labels such as email_address instead of tables. The Connector follows each returned column back to its source columns, so the mask applies through wildcards, joins and unions too.

  • col["data_label"] and col["tags"] on each returned column
  • New columns are covered from the scan that labels them, with no policy edit
  • Dry-run first, so logs show what would have been masked
psql · prod-postgresexample
maya@acme.com> SELECT * FROM customers LIMIT 2
nameemailcreated_at
Jane Doe****@example.com2026-03-02
Tom Berg****@example.com2026-02-11
2 rows · policy redact.partial on email_addressMASKED
Audit

See who read each label

Every query log lists the returned columns with their path and data_label (log schema), on the same entry as the user, the BI end user and the policies that fired. Instead of asking where SSNs live, you can search for every query this week that returned a column labelled social_security_number with no mask applied, and see whether the reader was an engineer in psql, a Metabase viewer or an agent.

  • response.datastore.returned_columns.data_label holds the label
  • user.formal.user.email and user.formal.end_user.email sit on the same entry
  • triggered_policies.type shows whether a mask fired
logs · searchexample
querysearchreturned_columns.data_label:social_security_number AND NOT triggered_policies.type:mask
matchclaude-cli · maya@acme.comSELECT ssn FROM employeesALLOWED
AI agents

Agents get the same labels and masks

Agents are why we care about this placement: a coding agent with database access can run SELECT * on a table nobody has reviewed yet. When it connects as its own machine user through the Connector, or through the Formal Endpoint, the labels and masks apply to it as they do to an engineer, and its queries land in the same log.

How people and agents connect: database access ›
psql · prod-postgresexample
11:42:09claude-code for mayaSELECT * FROM app.public.customersMASKED
11:42:09connectoremail (email_address) · redact.partialMASKED

The limits

What our data classification software doesn't scan

Database columns and MongoDB documents are the whole scope.

  • Database columns and MongoDB documents

    Scanned on a schedule and labelled with regex or prompt labels.

    Scanned
  • Files, SaaS applications, endpoints and S3 objects

    Outside the scope. The FAQ covers what to pair Formal with for those.

    Not scanned
  • Prompts

    Column labels aren’t applied to prompt text. Redacting PII before it reaches a model provider is a request-stage rewrite policy, covered on AI data loss prevention. Gusto’s deployment below is that path: PII and PHI masked between Salesforce and an LLM provider, which shows the policy engine this page feeds rather than column discovery itself.

    Separate path
  • Values in unlabelled columns

    Labels come only from discovery scans. The Connector applies the labels it has and doesn’t classify the values in each result as they pass, so a sensitive value in a column nobody labelled goes through unmasked.

    Not masked

Deployment

The Satellite and the Connector both run in your environment

Deployment6 items
01

Data Discovery Satellite

A container next to your Connectors, on ECS, Kubernetes or Docker (Satellites).

02

Formal Connector in your VPC

Linux on AMD64 or ARM64: AWS ECS Fargate behind a Network Load Balancer, or Helm on EKS, GKE, AKS or on-premises Kubernetes. In production, run 2 or more nodes behind a load balancer (deployment).

03

Your identity provider

People sign in with SSO, and SCIM keeps users and groups in sync. Policies use the groups you already manage.

04

Logs in your SIEM

Log integrations forward Formal logs to AWS S3, Google Cloud Storage, Azure Blob Storage, Datadog, Splunk or Panther.

05

Policy and configuration as code

Policies are written in Rego. Manage Formal with Terraform, Pulumi or the Kubernetes Operator.

06

Audited controls

Formal holds SOC 2 Type II and ISO/IEC 27001. The reports are on security.formal.ai.

Works with

Works with your data stores and your stack

The data stores below are the ones in the Data Discovery release notes. Labels are managed in the Control Plane, the API or Terraform, and the policies that read them apply to people, BI viewers and AI agents.

  • Postgres
  • MySQL
  • Snowflake
  • Redshift
  • MongoDB and Atlas
  • Amazon Bedrock (Claude Haiku)
  • Terraform

In production

Implementation
5 days
Requests secured
100K+
“Formal Satellites simplified ensuring any PII or PHI entities between Salesforce and our LLM provider were automatically detected and masked, without needing detailed data structure knowledge.”
Ian Wardell
Data Privacy Lead, Gusto
Read the Gusto story ›

FAQ

Questions about data classification tools

Buying and fit

What is a data classification tool?

It’s software that works out which of your data is sensitive and records the answer where other controls can use it. When comparing data classification software, ask three things: which stores it reads (files, SaaS, databases), how it decides (patterns, a model, or both, and what the model sees), and what consumes the result (a report, a DLP rule, an access policy). Formal reads databases and feeds access policies.

What are the 5 data classifications?

Data security classification schemes vary, and there is no single standard set of five. Many company policies use four or five sensitivity levels, such as public, internal, confidential and restricted, and US federal systems use the low, moderate and high impact levels of FIPS 199. Formal labels data types rather than levels. To carry your levels, add them as tags (restricted), which policies read next to the label.

Is automated data classification accurate enough to mask by?

We don’t publish accuracy or false-positive rates for prompt labels, and a classifier that sees 10 values per column will sometimes miss. Regex labels are deterministic on the column path. Our approach with any data classification software: run masking policies in dry-run first, review the labels in Data Inventory, fix the wrong ones and lock them so the next scan keeps your correction.

Product

Does AI classification send my data outside my cloud?

Prompt labels send Amazon Bedrock the column’s name and type plus at most 10 sampled values, and the Satellite makes that call with its own AWS credentials, in your account and region. Regex labels read no rows at all. If you’d rather not sample production data, use regex labels only; the built-in labels are prompt labels, so you’d write regex equivalents for the types you need.

Which databases does Formal discover and classify?

The Data Discovery release notes include Postgres, MySQL, Snowflake, Redshift and MongoDB, with MongoDB and Atlas classified by document sampling. Ask us about other engines before you plan around them. Masking by label covers a wider list through the Connector, described on data masking.

How is this different from sensitive data discovery tools for files and SaaS?

Data discovery and classification tools for unstructured data crawl file shares, Microsoft 365, SaaS apps and object storage, and Formal does none of that. Its PII discovery covers database columns and MongoDB documents. If your exposure is mostly documents and collaboration tools, buy a DSPM or information-protection product for them, and run Formal for the databases, the BI tools and the agents that query them.

Label sensitive columns, then mask by label

Data classification for your databases, with every label usable in policy for people, BI tools and AI agents.