docs

Schema Discovery and the Registry

Applies to: VaultKit 0.12.0-alpha with vkit 1.5.0

Policies act on labels, not column names. The registry lists every dataset VaultKit knows, with each field’s sensitivity and category. A scan fills it in for you; you review it in git and deploy it with your policies.

The workflow

vkit scan prod_db                    # what changed since the last scan
vkit scan prod_db --mode apply       # save the scan to the control plane
vkit registry export                 # write it to datasets/registry.yaml
# review and edit datasets/registry.yaml, then:
git commit -am "Review registry labels"
vkit policy bundle && vkit policy deploy

The deployed bundle carries the registry, so the labels you commit are the labels policies use.

registry.yaml

customers:
  datasource: prod_db
  fields:
    id:          { type: integer, sensitivity: low,     category: internal }
    email:       { type: text,    sensitivity: medium,  category: pii }
    ssn:         { type: text,    sensitivity: high,    category: pii }
    preferences: { type: jsonb,   sensitivity: unknown, category: unknown }
tickets:
  datasource: prod_db
  tenant_column: organization_id
  fields:
    organization_id: { type: uuid, sensitivity: low, category: internal }

A field’s category is the tag that policies match with contains. You can use your own categories, for example marketing, and match them in policies the same way. tenant_column marks a dataset as tenant-scoped; see Tenant-scoped datasets.

The labels a scan suggests

Sensitivity Category Columns like
high credential password, password_digest, api_key, access_token, client_secret, private_key; the value column of a table of secrets
high pii government IDs (ssn, passport_number, tax_id), payment cards (card_number, cvv, cc_last4), health (diagnosis, medical_history), special-category data (ethnicity, religion)
high financial bank accounts (iban, account_number, routing_number)
medium pii email, phone, names, addresses, date of birth, IP addresses and user agents, location, gender
medium financial amounts (amount, total, balance, price), compensation (salary, income)
low internal IDs, timestamps, flags, counts, status, sort_order, product_name, currency
unknown unknown text or JSON columns it couldn’t place: data, value, payload, meta, notes, body, description

How it decides:

The scan reads column names and types only, never data. A column named data that holds emails is unknown, not pii: that’s what review is for.

Reviewing

Rescans

A rescan never overwrites labels you’ve reviewed.

Columns the registry doesn’t have

Requests are checked against the deployed bundle’s registry before any policy runs (0.12.0-alpha). A field the registry doesn’t have is refused with 422, and the message lists the fields the requester can use: “Unknown field brand on payment_methods. Valid fields: id, card_brand, …”. This applies wherever the field appears: a column, a filter, an aggregate, grouping, sorting or a join. Postgres system columns such as xmin and ctid are never in the registry. The request is recorded on the Activity page as Rejected.

The reverse can happen too: a column the registry has but the database no longer does, renamed or dropped since the last scan. The query then fails when it runs, with “Column x doesn’t exist on dataset” and a request to rescan. Activity shows the request as failed, and the Agents page marks its grant “Fails: column doesn’t exist”.

Either way, rescan, review and redeploy so the registry matches the database again.

What a requester can see

GET /api/v1/orgs/:org/aql/datasets lists the datasets a requester can query, and GET /api/v1/orgs/:org/aql/datasets/:name/schema lists a dataset’s fields. Agent tokens can call both. The MCP server’s vaultkit_discover and vaultkit_describe tools use them. From 0.12.0-alpha they say what a request would get, evaluated as a real request would be: in the dataset’s datasource environment and region, with the requester’s role, clearance, region and tenant.