2. Implementation Playbook
The roadmap is split into six phases following the principle “visibility first, then tighten.” Each phase delivers independent value.
Roadmap overview
| Phase | Name | Core output | Depends on |
|---|---|---|---|
| 1 | Survey & data mapping | PII map + classification matrix | None |
| 2 | Centralized audit | Every PII access has an immutable trail | P1 |
| 3 | Encryption & masking | Data meaningless if stolen | P1 |
| 4 | Access control | Least-privilege, default-deny | P2, P3 |
| 5 | Monitoring & detection | Real-time alerts, drills | P2, P4 |
| 6 | Compliance & operations | Decree 13/2023 compliance evidence | P2–P5 |
Phase 1 — Survey & data mapping
Goal: know exactly where PII lives before protecting it.
- List every storage: databases, shared files, logs, backups, partner data.
- Run automated PII discovery for name, phone, email, address, ID fields.
- Classify each field by sensitivity and decide the measure: encryption, masking, or both.
- Draw the data flow: where PII enters, which systems read it, where it flows out.
- Map obligations under Decree 13/2023.
- Build a data processing register.
Phase 2 — Centralized audit (top priority)
Goal: achieve visibility immediately. This phase delivers the most value for leak prevention.
- Design the audit record schema: time, identity, action, record id, purpose, result.
- Choose tamper-resistance: append-only + hash-chaining.
- Store audit separately from the business DB.
- Integrate audit recording at the app / data access layer.
- Bind purpose to read requests.
- Build an observation dashboard and basic alerts.
- Verify integrity (chain verify).
CREATE TABLE pii_audit ( id BIGSERIAL PRIMARY KEY, ts TIMESTAMPTZ NOT NULL DEFAULT now(), actor TEXT NOT NULL, action TEXT NOT NULL, subject_ref TEXT NOT NULL, field TEXT, purpose TEXT NOT NULL, result TEXT NOT NULL, prev_hash TEXT, row_hash TEXT NOT NULL);-- INSERT only; revoke UPDATE/DELETE for all app rolesPhase 3 — Encryption & masking
Goal: make data meaningless if stolen, and limit staff from seeing full PII.
- Enable TDE for at-rest encryption.
- Deploy dedicated key management (KMS/HSM or HashiCorp Vault), separate from data and DBA privileges.
- Apply column-level encryption to sensitive fields; use blind index for exact lookups.
- Define Dynamic Data Masking policies by role.
- Remove PII from logs, error messages, URLs.
- Test on staging, measure performance, then roll out to production by table groups.
phone_enc BYTEA -- ciphertextphone_bidx TEXT -- = HMAC(key, normalize(phone))WHERE phone_bidx = hmac_lookup('0901234567')Phase 4 — Access control
Goal: move from “everyone can read” to “least-privilege, default-deny”.
- Design RBAC based on real job roles.
- Apply least-privilege and default-deny.
- Enable Row-Level Security for row scope.
- Require purpose for every PII access.
- Apply four-eyes approval for high-risk operations.
- Revoke existing broad privileges.
| Role | Readable fields | Scope (RLS) | Four-eyes? |
|---|---|---|---|
| CS Agent | Name, phone (partly masked) | Assigned customers | On bulk read |
| Order Ops | Name, address, phone | Orders in shift | On file export |
| Marketing | Blind index / segments only | All (anonymized) | Always (export) |
| Data Admin | On demand, with purpose | All | Always |
Phase 5 — Monitoring, detection & drills
Goal: detect early and respond fast.
- Analyze audit to set a baseline of normal access.
- Define anomaly detection rules.
- Wire alerts into ops channels (SIEM/Slack/on-call).
- Build an incident response process.
- Run periodic drills with simulated leak scenarios.
- Verify traceability of a single record.
Phase 6 — Compliance, audit & continuous operations
Goal: turn technical effort into compliance evidence, sustained over time.
- Compile Decree 13/2023 compliance evidence.
- Establish a DSAR (data subject request) process.
- Engage third-party pentest.
- Run periodic access reviews.
- Operate the encryption key lifecycle (rotation/revocation).
- Update the data map when new fields/systems appear.