hashgraph-online/awesome-codex-plugins / plugins/AltByteSG/personal-data-protection-skill/skills/personal-data-protection
personal-data-protection
VerifiedPersonal-data-protection compliance reference for engineers building applications subject to Singapore PDPA, Indonesia UU PDP, Thailand PDPA, Malaysia PDPA, Philippines DPA (RA 10173), or Vietnam PDPL (91/2025/QH15). Use when reviewing or modifying code that touches personal data — signup/auth/consent, data export, account deletion, retention/purging, admin access to personal-data stores, third-party processors, breach response, or privacy/T&C documents.
layers/07-operational.md
View on GitHub# Layer 07 — Operational
> ⚠ **Reference material only — not legal advice.** See [DISCLAIMER.md](https://github.com/AltByteSG/personal-data-protection-skill/blob/main/DISCLAIMER.md). Verify against the official statute and consult a qualified DPO / lawyer.
Run-time concerns: incidents, retention sweeps, monitoring, vendor reviews. Universal across stacks; specific deadlines vary by jurisdiction (see active `jurisdictions/<code>/obligations/06-breach-notification.md`).
## Contents
- Incident response
- Retention sweeps
- Log retention
- Backups
- Vendor reviews
- Monitoring and breach detection
- Admin audit log review (when multi-admin)
- Insurance
- Documentation discipline
## Incident response
**Primary document:** an incident-response runbook that lives in the project repo, owned by the DPO. Template at `templates/INCIDENT_RESPONSE.md.template` — copy and customise for your stack and contacts.
The runbook must be specific enough to act on at 2am. Generic content ("notify the regulator") is useless during an incident; specific content ("file via [portal URL] using the saved template at [path]") is what matters.
### Quick reference (do not substitute for the runbook)
| Step | When |
|---|---|
| Detect / become aware | Happens by chance until observability is in place |
| Contain (rotate keys, revoke endpoints, sign out users) | First hour |
| Assess notifiability per the active jurisdiction's threshold | "Reasonable + expeditious" — most regulators target ≤ 30 days from awareness |
| Notify regulator if notifiable | **Jurisdiction-specific deadline — see active `jurisdictions/<code>/obligations/06-breach-notification.md`** |
| Notify affected individuals if significant harm likely | Concurrent or shortly after regulator notification |
| Post-mortem | Within 30 days of resolution |
### Notifiability shortcuts (use the active jurisdiction's actual rules)
Most PDP-family statutes treat as notifiable:
- A breach affecting at least N individuals (the "significant scale" threshold; varies by jurisdiction)
- A breach involving sensitive categories at any scale (auth credentials, health, location-with-identity, children's data, financial info, private communications)
- An internal-only access (e.g. curious admin) is **not universally carved out — check the active jurisdiction before closing one without notifying.** SG has an explicit exclusion (s26B(4)); **TH does not** — under s37(1) it remains a breach and notifiability falls to the risk assessment. ID / MY / PH carry no explicit carve-out either, so treat the assessment as required. In every jurisdiction it IS a personal offence under the individual-criminal-liability provisions
### Sub-processor / vendor breaches
When a processor you use has a breach affecting your data, the procedure is the same
everywhere; only the provision that puts the reporting duty on the processor differs.
- Your DPA should require the processor to notify you **without undue delay**. Best
practice is to contractually require **≤ 24 hours**, so you retain time to assess
before your own clock expires.
- Your regulatory clock starts when **you** become aware — in practice, when the
processor notifies you. Their delay consumes your window, which is why the
contractual ceiling matters.
- Record the chain in the incident log: when the processor became aware → when they
notified you → when you assessed.
The statutory hook is per-jurisdiction — see the active
`jurisdictions/<code>/obligations/06-breach-notification.md`.
### Post-incident records
After any breach, add the post-incident remediation to your processing / security
records. This is the demonstrable-accountability principle in practice, and it is the
first thing a regulator asks for if they investigate. Each jurisdiction's obligation
file names the record-keeping provision that applies.
### Runbook readiness checklist
Verify before an incident, not during one:
- [ ] Regulator notification form pre-filled and saved, with the current submission
method confirmed
- [ ] DPO **and** a backup contact both hold credentials to submit
- [ ] Data-subject notification template pre-staged **in the languages your users
read** — several jurisdictions expect or require the local language
- [ ] Incident log location documented, using the awareness-timestamp pattern
- [ ] Vendor DPAs carry a breach-notification clause with a time ceiling
- [ ] Annual review of the runbook scheduled
Starting point: `templates/INCIDENT_RESPONSE.md.template`.
## Retention sweeps
A canonical "PDP cleanup" job that runs daily at off-peak (e.g. 03:00 local time):
1. Soft- or hard-deletes data past its retention period
2. Cleans up associated storage (files, blobs)
3. Logs what was removed (counts, not content)
**Verify the job is alive (recommended monthly):**
- Check the cron / scheduler dashboard for the last successful run
- Alert if the last run is more than ~25 hours old (one cycle missed)
If your platform supports it, expose a manual "run now" trigger in admin tooling so the job can be invoked outside its normal schedule for testing or after a recovery.
## Log retention
| Log source | Retention | Why |
|---|---|---|
| Admin audit log (table) | 7 years (defensible); indefinite (debatable when challenged) | Accountability evidence |
| Consent log (table) | Indefinite or per consent-record retention rule | Consent evidence |
| Operational rate-limit ledgers | Hours to days | Operational only, not PII |
| Deletion audit (email hashes etc.) | 7 years (defensible) | Deletion-request evidence |
| Application server logs | Whatever your platform default is (typically days–weeks) | Operational debugging |
| Database query logs | Same as application logs | Operational |
| Crash / error reporting | 30–90 days typical | Incident investigation |
**PII in logs:** apply the redaction patterns from [layer 04](04-controls-and-processes.md) at every log site. Verify periodically by sampling production logs for raw email addresses, full UUIDs, or token-shaped strings.
## Backups
Most managed databases offer point-in-time recovery (PITR) with a configurable retention window (typically 7–30 days). Backups inherit:
- Same encryption-at-rest as primary
- Same regional placement
- Same access controls on restore
When a user deletes their account, their data persists in backups for the backup retention window. Disclose this in the privacy policy: *"Some data may be retained longer in encrypted backups, which are purged on a rolling schedule."*
PDP-family statutes generally accept backup retention as long as the schedule is documented and bounded.
## Vendor reviews
When adding a new sub-processor: see [`checklists/new-vendor.md`](../checklists/new-vendor.md).
**Quarterly** (when scaling past beta / first 100 users):
- Walk through the sub-processor table in the privacy policy and verify each entry against actual code paths (any new external-domain calls?).
- Confirm DPAs are still in force.
- Check vendor status pages for incidents during the quarter.
- Note any pending vendor changes (deprecations, region migrations) that need privacy-policy updates.
## Monitoring and breach detection
Without monitoring, breach detection is luck. Minimum signals to set up before scaling past beta:
| Signal | Why |
|---|---|
| Failed-auth volume alarm | Credential-stuffing or brute-force attempts |
| Mass-export rate-limit alert | Abuse of the data-export endpoint, or compromise via legitimate sessions |
| Storage egress anomaly | Bulk download of user files |
| Repository secret scanning | Leaked API keys / credentials in commits |
| External monitoring of key user-facing endpoints | Detect outages and misconfigurations |
| Quarterly admin audit log review | Detect unauthorised access by authorised people |
These feed the breach-detection capability that the regulatory clock depends on. Without them, "detection" means "a user complains" — and the clock has been ticking for an unknown period before that.
## Admin audit log review (when multi-admin)
Once more than one person has admin access:
**Quarterly schedule:**
1. Pull the past 90 days of admin audit log entries
2. Spot-check unusual patterns:
- One admin viewing many distinct users in a short time
- Off-hours activity
- Repeat views of the same record
- Actions on accounts the admin had no reason to touch
3. Document findings in the staff access log
4. Adjust AUP or training as needed
While solo: this is a self-discipline check — useful but not load-bearing. The moment a second person has the role, it becomes structurally necessary.
## Insurance
Cyber-liability insurance is increasingly available for small organisations. Premiums depend on:
- Number of records held
- Categories of data (sensitive categories raise premiums)
- Existing controls (MFA, encryption, audit logging, breach response capability)
- Industry sector
Worth a conversation with a broker once you have meaningful numbers of users. Not a substitute for compliance, but a backstop.
## Documentation discipline
Compliance posture in an audit is judged in large part on what you can show. Keep:
- A dated **compliance evidence bundle** per major release (snapshot of policies, vendor list, audit log review, etc.)
- **Incident logs** for every incident, even minor ones — pattern visibility matters more than individual severity
- **Decision logs** for compliance-relevant choices ("we decided X because Y, accepting risk Z")
- **Training records** if more than one person has access
Solo founders often skip this. Don't — the cost of writing it down is small; the cost of not having it during an enforcement action is large.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |