Skip to Content
dbmcp

Templates

Ready-made privacy rules for popular applications, to paste into your config

Templates are built from each application's schema files at pinned releases, not yet checked against a running instance. Compare the keys with objects output before relying on one (Checking the keys).

One customer's e-mail address, name, and address sit in many tables: accounts, addresses, carts, orders, admin grids, newsletter lists, reviews. A forgotten table comes back unredacted, and a mistyped key matches nothing without warning (Column keys). Each page below lists them for one application.

Using a template

  1. Copy the page's template into your config; on pages with a version selector, pick your version first. If the config already has a privacy: section, paste the rules under its rules:.
  2. Delete what you do not want: columns under a # … (optional) comment for modules or data you do not need ruled (keeping them is harmless), and the mixed-content rule if the assistant needs those columns readable. Keep mixed-content-secrets (Mixed-content columns).
  3. Set database.name on MySQL, MariaDB, and PostgreSQL: short table.column keys need it (on SQLite they expand to main.main). Pinning a name removes the database parameter and objects kind: "database".
  4. If your installation prefixes its tables, prepend the prefix to every table in the keys (Table prefixes).
  5. Set privacy.key so hash tokens stay stable across restarts and replicas.
database:
  backend: mysql
  name: shop
privacy:
  mode: rules        # or full
  rules:
    # pasted template
    emails:
      columns:
        - customer.email
        - order_customer.email
      entity: EMAIL_ADDRESS
      operator: hash
    # your own rules
    loyalty-cards:
      columns:
        - loyalty_member.card_number
      entity: CREDIT_CARD
      operator: redact

Templates are docs, not files for --config-file: the last config file that sets privacy.rules replaces it whole, so a template file could not sit under your own rules.

Page layout

Every page has the same sections:

  • Coverage: versions, engines, whether the application prefixes its tables, and forks where they differ.
  • Template: one complete template, or one per version behind a version selector. Optional columns sit under a # <module or data> (optional) comment; the mixed-content and mixed-content-secrets rules come last. Then Choices: what the template decides beyond the conventions below, and what the optional parts hold.
  • Trade-offs: indexed ruled columns, lookups that stop working, unruled join keys.
  • Not covered: personal data the template leaves out, and why.
  • Sources: the schema files, pinned.

A template may list keys for columns your version or modules lack: they match nothing and are accepted at startup. Where a page records when a key appeared, a YAML comment says so (# 5.7+, # 9.1 only).

Conventions

Every rule states its operator, so a template does not depend on privacy.operator. A hash entity is hashed in every column of a template, so a value gets the same token in every column that holds it, and the assistant can match a customer's rows across tables without seeing the value. Re-copying a hash rule whose entity changed changes its tokens (How values are rewritten). Rules are named after the data they hold:

DataRuleEntityOperator
E-mail addressesemailsEMAIL_ADDRESShash
Names, usernames, loginsnamesPERSONhash
Phone numbersphonesPHONE_NUMBERhash
IP addressesip-addressesIP_ADDRESShash
Street and city, postcodes, companiesaddresses, postcodes, companiesLOCATION, POSTCODE, ORGANIZATIONhash
Provider, visitor, tracking, and device ids; employee and student numbersuser-idsUSER_IDhash
User agentsuser-agentsUSER_AGENThash
IBANsibansIBAN_CODEhash
Other bank account numbersbank-accountsBANK_ACCOUNThash
BICs; sort, branch, and bank codesbics; bank-codesBIC_CODE; BANK_CODEhash
VAT numbersvat-numbersVAT_NUMBERhash
Other tax ids; German tax numberstax-ids; tax-numbersTAX_ID; TAX_NUMBER_DEhash
Registry numbersregistry-numbersCOMMERCIAL_REGISTER_DE or COMMERCIAL_REGISTER (one per page)hash
National ids, passports, residence permits, licence platesid-cards, passports, residence-permits, license-platesNATIONAL_ID, PASSPORT, RESIDENCE_PERMIT, LICENSE_PLATEreplace
Social security and insurance numberssocial-security-numbersSOCIAL_SECURITYreplace
Birth dates, URLsbirth-dates, urlsDATE_OF_BIRTH, URLreplace
Free text (notes, messages, comments)textFREE_TEXTreplace
JSON, serialized, and other mixed-content columnsmixed-contentMIXED_CONTENTreplace
Card numbers, CVVs, eCheck routing numberscards, card-codes, routing-numbersCREDIT_CARD, CVV, ROUTING_NUMBER_USredact
Password hashespasswordsPASSWORD_HASHredact
Plaintext passwords, PINs, enrolment keysplaintext-passwordsPASSWORDredact
Session, remember-me, reset, invite, and share tokens; opt-in, voucher, and gift card codestokensAUTH_TOKENredact
TOTP seeds, backup and one-time codesotp-secretsOTP_SECRETredact
API keys, OAuth tokens, client and webhook secrets, ciphertext, saltssecretsAPI_KEYredact
Payment provider referencespayment-tokensPAYMENT_TOKENredact
Push endpointspush-endpointsURLredact
Private keysprivate-keysPRIVATE_KEYredact
Mixed-content columns that hold credentials (settings, sessions, headers)mixed-content-secretsMIXED_CONTENTredact

A login that is always an e-mail address goes in emails, so it gets the same token as the address elsewhere. Entities only label: a ruled column is rewritten whatever its values look like, and a query that combines columns of different entities in one output column is refused. Data no recognizer detects gets a rule-only entity, so it never shares a token with a detected type. Titles, gender, country and region codes, locale, and timestamps stay unruled.

Rule names are generic, so a template's rules clash with your own rules of the same name, and with another template's: merge their columns lists instead of pasting a second emails:. Two templates for one database can also rule the same column, which stops startup as a repeat: Mastodon is built on Devise, so its template already holds the Devise columns of users; paste only one of them.

Table prefixes

Templates use the table names of an unprefixed installation. Keys take no wildcards, so if your installation prefixes its tables (WordPress wp_, Moodle mdl_, PrestaShop ps_), prepend the prefix to every table: users.user_email becomes wp_users.user_email. Each page says whether and where the application sets one.

Schemas and names

Short keys name the public schema on PostgreSQL and main on SQLite; for another schema, write <schema>.<table>.<column>. Keys compare case-insensitively and need no quotes, but the assistant's SQL must quote reserved table names ("user", `order`) and, on MySQL on Linux, use the stored case. A query through a view gets its base columns' rules.

Trade-offs

  • No lookups by ruled values. A ruled column cannot appear in WHERE, JOIN, GROUP BY, or ORDER BY (Where a ruled column may appear), so "find the customer with this e-mail" stops working. Find rows by id and join on the keys each page lists as unruled.
  • Indexed columns. Without ORDER BY, rows may come back in the order of an index on a ruled column, the row-order residual risk. Each page names the indexed columns it rules.
  • Writes. hash-ruled columns refuse most writes (Writes). Templates are meant for read-only use.

Mixed-content columns

JSON, serialized, EAV, and meta_value columns mix personal data with everything else. A rule covers a column whole, so ruling one hides its harmless content too. Templates rule them in the mixed-content rule at the end, under an # Optional: mixed-content columns comment; delete it to keep the columns readable. Settings, session, and configuration columns that hold passwords and API keys sit in mixed-content-secrets (redact) beside it: keep that one, or its secrets come back readable. Under the full mode, global detection still scans unruled columns for e-mail addresses, IBANs, and other patterns.

Checking the keys

After pasting, compare every key with objects output (detail: "full" lists the columns). Startup catches repeats, a missing database.name, and a wrong catalog segment, but not a column that does not exist.

Applications

On this page