check-safety/docs/adr/0007-personal-data-is-classified-deterministically-and-public-routes-cover-site-data-tables.md
Alex Dunmow 8b8afc044d Classify personal data deterministically and cover site data tables in check 33 (ADR 0007)
A factory spec's personal flags come from Scout. For a factory-generated
plugin, names, sample shapes, visitor form fields and migration columns
now mark personal data too, and the stricter result applies. A public
route that reads a site data table, or personal plugin settings, fails
check 33. frontend.go, plugin_egress.go, plugin_html.go and
plugin_routes.go carry the lint autofixes check 3 applies to this repo.

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

52 lines
3.6 KiB
Markdown

# 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