Custodian user guide

Custodian adds GDPR controls to an application that uses EF Core or Dapper. You classify your personal data once, on the entities. Custodian then decides who may read it and for what purpose, links every personal row to its data subject and tenant, encrypts what you mark, removes data when its retention ends, answers data-subject requests, and records all of it in a tamper-evident audit trail.

How this guide is kept true

Every code block in this guide is copied from the sample applications in samples/, and every claim about behaviour links to an acceptance test that proves it. Where no sample uses a feature, the code comes from Custodian's own tests, and the page says so. The samples build on every push. Their tests run against real SQL Server 2022 and PostgreSQL 16 databases.

There are two samples:

Pages

Start here:

  1. Getting started. Wire Custodian into an application and see it refuse a query.
  2. Classifying personal data. Attributes for categories, purposes, lawful basis and retention.
  3. Roles and purposes. Who may process what, and what happens outside a purpose.
  4. Tenants and row-level security. Database roles, session context, Dapper.

Protecting and removing data:

  1. Encryption and blind indexes. Field encryption, lookup by encrypted value, crypto-shredding.
  2. Retention. Expiry, the retention worker, legal holds, dry runs.
  3. Data-subject rights. Access, portability, rectification, restriction, consent withdrawal, erasure.

Special kinds of access:

  1. Assisted access. Customer service working on one customer's behalf.
  2. System runs. Batch jobs and other machine principals.
  3. Health data and break-glass. Special-category data and audited emergency access.

Operating it:

  1. Audit trail. What is recorded, what never is, and how tampering is detected.
  2. ASP.NET Core. The context middleware and the rights, break-glass and assisted-session endpoints.
  3. Command-line tool. The Art. 30 report, dry-run purge, audit verification.
  4. Onboarding a legacy database. Scanning an existing database and reviewing its classification.