check-safety/docs/adr/0007-personal-data-is-classified-deterministically-and-public-routes-cover-site-data-tables.md
Alex Dunmow 945ca508e0 Judge site data table reads by the fields the spec declares (ADR 0007 amendment)
With data_tables in acceptance.json, a public route over a site data
table fails check 33 only when the table read holds a personal field by
the spec or the classifier. The table is resolved from a literal
GetTableByKey key; an unresolved read falls back to any declared table
being personal. Without data_tables every read stays personal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:48:11 +08:00

4.8 KiB

Personal data is classified deterministically, and public routes cover site data tables

Builds on ADR 0006. Orchestrator WO-100 (gaps 5, 6 and 7 of WO-097).

Checks 33, 36 and 37 took personal data names from the factory spec alone. Scout writes the spec, so a spec that marked email as not personal turned the log and egress rules off for it, a notes column that stores visitors' phone numbers was never personal, and a public route that listed a site data table was not flagged because only the plugin's own tables were traced.

Decision: for a factory-generated plugin (an acceptance.json at the root), a deterministic classifier runs over the spec and the generated schema and the stricter result applies.

  • A name is personal when the spec says so or its words do: email, phone and its synonyms (mobile, tel, cell, fax, sms), birth or dob, address and its parts (street, postcode, zip, postal), identifiers (ip, ssn, passport, password, licence, medicare), and person names (name, first, last, full, given, family, or an owner word such as customer, client, contact, guest or visitor before name). town_name and business_name are not personal.
  • A field whose sample looks like an email address or a phone number is personal. A run of digits counts as a phone number only with a leading 0 or +, or with separators, so timestamps and amounts do not.
  • Every field of a public or visitor POST route is personal: it is free text a visitor types. A table column with the same name is personal, which covers the notes example.
  • migrations/*.sql CREATE TABLE columns that are personal by name, or typed inet or cidr, make their table personal, including tables the spec never listed.
  • In a generated plugin a public route that reads a site data table (DataTables.ListRows, GetRow, FindRowByField) fails check 33, because a site data table's fields are not in the spec and the check cannot prove they hold no personal data. GetPluginSettings counts as a personal read when a setting is personal.
  • A value passed through len() carries no personal data, so logging a length is allowed.

The CMS host runs the same name rules at runtime for factory-built plugins (cms ADR 0233, plugin/factory_guard.go personalKind), where it also classifies values by shape. The two copies are small and must stay aligned; check-safety stays standalone and imports nothing from the CMS.

Rejected: sharing the classifier through a pluginsdk package. The CMS go.mod would have to move to an unreleased pluginsdk version, and check-safety imports no sibling module.

Consequences:

  • pluginrules_classify.go (personalKind, sampleKind, migrationColumns); indexSpec, indexQueries and storedPersonalReads in pluginrules.go use the classified set (personalTables, personalSettings).
  • Fixtures testdata/pluginrules/signups-datatable-fail (a route.Public GET listing the signups data table) and classifier-fail (a spec that marks email and notes not personal, and a migration table callers with mobile and an inet column). Tests TestPluginRoutesFlagsPublicRouteReadingASiteDataTable and TestPluginClassifierOverridesTheSpecsPersonalFlags.
  • First-party plugins keep the default name list and warnings only.

Keywords: personal data classifier, deterministic classifier, personalKind, sampleKind, migrationColumns, personalTables, personalSettings, site data table, DataTables, ListRows, GetRow, FindRowByField, GetPluginSettings, check 33, check 36, check 37, visitor form, free text, inet, cidr, notes column, WO-100, gap 5, gap 6, gap 7, acceptance.json

Amendment 2026-11-22: declared site data tables

Since orchestrator WO-099 the spec declares the site data tables a plugin reads (data_tables[] with key and fields[]), and the rule above refused the events plugin's public /events.ics feed. When the spec has data_tables, a site data table read counts as personal only when the table it reads has a field marked personal or one the classifier calls personal (by name or sample shape), so a public route over an events table passes and one over a table with an email field fails even when the spec marks it not personal. The table is resolved from the literal key of a GetTableByKey call in the same function; a read whose table cannot be resolved statically counts as personal when any declared table is, and a literal key the spec does not declare counts as personal. Without data_tables in the spec the earlier rule stands: every read is personal. Fixtures events-datatable-pass and subscribers-datatable-fail, test TestPluginRoutesJudgeSiteDataTablesByTheirDeclaredFields. Declared data table fields also join the personal names the log and egress rules use.

Keywords: data_tables, declared site data table, dataTableReadPersonal, personalDataTables, GetTableByKey, events.ics, events-datatable-pass, subscribers-datatable-fail