Skip to content

hashgraph-online/awesome-codex-plugins / plugins/AltByteSG/personal-data-protection-skill/skills/personal-data-protection

personal-data-protection

Verified

Personal-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.

FileKindSize
SKILL.mdskill md14.5 KB
checklists/breach-response.mdmarkdown5.6 KB
checklists/new-data-field.mdmarkdown6.8 KB
checklists/new-feature.mdmarkdown11.2 KB
checklists/new-vendor.mdmarkdown7.1 KB
jurisdictions/_index.mdmarkdown12.6 KB
jurisdictions/id-pdp/README.mdmarkdown8.7 KB
jurisdictions/id-pdp/obligations/01-accountability.mdmarkdown12.4 KB
jurisdictions/id-pdp/obligations/02-consent.mdmarkdown7.5 KB
jurisdictions/id-pdp/obligations/03-purpose.mdmarkdown7.0 KB
jurisdictions/id-pdp/obligations/04-access-correction.mdmarkdown8.9 KB
jurisdictions/id-pdp/obligations/05-care.mdmarkdown7.1 KB
jurisdictions/id-pdp/obligations/06-breach-notification.mdmarkdown7.4 KB
jurisdictions/id-pdp/obligations/07-offences.mdmarkdown7.6 KB
jurisdictions/id-pdp/statute-map.mdmarkdown12.5 KB
jurisdictions/my-pdpa/README.mdmarkdown10.2 KB
jurisdictions/my-pdpa/obligations/01-accountability.mdmarkdown6.5 KB
jurisdictions/my-pdpa/obligations/02-consent.mdmarkdown10.0 KB
jurisdictions/my-pdpa/obligations/03-purpose.mdmarkdown9.1 KB
jurisdictions/my-pdpa/obligations/04-access-correction.mdmarkdown11.1 KB
jurisdictions/my-pdpa/obligations/05-care.mdmarkdown11.5 KB
jurisdictions/my-pdpa/obligations/06-breach-notification.mdmarkdown7.6 KB
jurisdictions/my-pdpa/obligations/07-offences.mdmarkdown8.1 KB
jurisdictions/my-pdpa/statute-map.mdmarkdown10.4 KB
jurisdictions/ph-dpa/README.mdmarkdown12.8 KB
jurisdictions/ph-dpa/obligations/01-accountability.mdmarkdown8.3 KB
jurisdictions/ph-dpa/obligations/02-consent.mdmarkdown12.0 KB
jurisdictions/ph-dpa/obligations/03-purpose.mdmarkdown8.7 KB
jurisdictions/ph-dpa/obligations/04-access-correction.mdmarkdown13.4 KB
jurisdictions/ph-dpa/obligations/05-care.mdmarkdown13.6 KB
jurisdictions/ph-dpa/obligations/06-breach-notification.mdmarkdown11.2 KB
jurisdictions/ph-dpa/obligations/07-offences.mdmarkdown11.3 KB
jurisdictions/ph-dpa/statute-map.mdmarkdown10.9 KB
jurisdictions/sg-pdpa/README.mdmarkdown5.4 KB
jurisdictions/sg-pdpa/obligations/01-accountability.mdmarkdown4.0 KB
jurisdictions/sg-pdpa/obligations/02-consent.mdmarkdown6.9 KB
jurisdictions/sg-pdpa/obligations/03-purpose.mdmarkdown4.4 KB
jurisdictions/sg-pdpa/obligations/04-access-correction.mdmarkdown6.5 KB
jurisdictions/sg-pdpa/obligations/05-care.mdmarkdown6.9 KB
jurisdictions/sg-pdpa/obligations/06-breach-notification.mdmarkdown10.5 KB
jurisdictions/sg-pdpa/obligations/07-offences.mdmarkdown6.6 KB
jurisdictions/sg-pdpa/statute-map.mdmarkdown8.0 KB
jurisdictions/th-pdpa/README.mdmarkdown7.3 KB
jurisdictions/th-pdpa/obligations/01-accountability.mdmarkdown7.1 KB
jurisdictions/th-pdpa/obligations/02-consent.mdmarkdown8.5 KB
jurisdictions/th-pdpa/obligations/03-purpose.mdmarkdown4.9 KB
jurisdictions/th-pdpa/obligations/04-access-correction.mdmarkdown7.0 KB
jurisdictions/th-pdpa/obligations/05-care.mdmarkdown7.3 KB
jurisdictions/th-pdpa/obligations/06-breach-notification.mdmarkdown7.0 KB
jurisdictions/th-pdpa/obligations/07-offences.mdmarkdown8.5 KB
jurisdictions/th-pdpa/statute-map.mdmarkdown8.1 KB
jurisdictions/vn-pdpl/README.mdmarkdown9.9 KB
jurisdictions/vn-pdpl/obligations/01-accountability.mdmarkdown5.0 KB
jurisdictions/vn-pdpl/obligations/02-consent.mdmarkdown5.1 KB
jurisdictions/vn-pdpl/obligations/03-purpose.mdmarkdown6.7 KB
jurisdictions/vn-pdpl/obligations/04-access-correction.mdmarkdown4.9 KB
jurisdictions/vn-pdpl/obligations/05-care.mdmarkdown5.0 KB
jurisdictions/vn-pdpl/obligations/06-breach-notification.mdmarkdown5.6 KB
jurisdictions/vn-pdpl/obligations/07-offences.mdmarkdown3.0 KB
jurisdictions/vn-pdpl/obligations/08-sector-specific.mdmarkdown4.4 KB
jurisdictions/vn-pdpl/statute-map.mdmarkdown9.5 KB
layers/01-non-technical.mdmarkdown4.9 KB
layers/02-architecture.mdmarkdown8.0 KB
layers/03-data-model.mdmarkdown8.4 KB
layers/04-controls-and-processes.mdmarkdown9.1 KB
layers/05-feature-ux.mdmarkdown9.0 KB
layers/06-disclosure.mdmarkdown6.5 KB
layers/07-operational.mdmarkdown9.5 KB
templates/INCIDENT_RESPONSE.md.templateother13.2 KB
templates/pdp-nudge.sh.templateother4.5 KB

layers/02-architecture.md

View on GitHub
# Layer 02 — Architecture & Infrastructure

> ⚠ **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.

Cross-cutting technical decisions that protect personal data at the system level. Universal across PDP-family jurisdictions; the principles apply regardless of cloud, database, or framework.

## Contents

- Data residency
- Cross-border processing (sub-processors)
- Encryption
- Access isolation (per-user data scoping)
- Privileged-function discipline
- Service / role separation
- Secret management
- Logging hygiene at the architecture level
- Defence in depth
- Backwards compatibility (when changing personal-data handling)

## Data residency

**Decide where your primary data store physically lives, and disclose it.**

Most PDP-family statutes treat cross-border transfers as a separate obligation requiring "comparable protection" in the destination. Keeping the primary store in the same jurisdiction as your users simplifies the transfer story. Where that's impractical, rely on contractual binding clauses in your vendor DPAs.

**Disclose** the storage location in your privacy policy. Don't change region without (a) updating the policy, (b) documenting the transfer-comparable-protection basis, (c) notifying users if the change is material.

## Cross-border processing (sub-processors)

Even when the primary store is local, individual data points typically flow to sub-processors hosted globally (push tokens to a notification provider, OAuth tokens to an identity provider, anonymised crash reports to a monitoring service). Each is a cross-border transfer requiring its own basis.

**What belongs in your sub-processor list (privacy policy disclosure):**
- Anything that processes user personal data on your behalf
- Authentication providers (Sign in with Apple, Google, etc.)
- Push notification providers
- Email/SMS delivery providers (when sending content involving user PII)
- Crash and error reporting services (if anonymisation isn't perfect)
- Any analytics service that receives identifiers

**What does NOT belong in the sub-processor list:**
- Pure transit infrastructure (CDN, edge cache) — they don't process at rest
- Source-code hosting and CI — they don't see production user data
- Internal developer tooling
- Vendors integrated but not yet activated (add at activation)

The line is "do they receive a value that maps to an individual user." If yes, list them.

## Encryption

Three places:

- **In transit:** TLS 1.2+ (1.3 preferred). Enforced for all client–server and server–server traffic.
- **At rest:** disk-level encryption on database, file storage, and backups. Most managed cloud providers offer this by default; verify it's on.
- **Passwords:** never stored in plaintext or with reversible encryption. Use a memory-hard hashing algorithm (bcrypt, scrypt, Argon2) — be precise about which one in the privacy policy.

If you describe encryption in your privacy policy, **be accurate about the algorithm**. Claiming bcrypt when you actually use scrypt is a factual misstatement in a legal document.

## Access isolation (per-user data scoping)

The default in any system that holds personal data must be: **no user can read another user's data unless explicitly authorised.**

Patterns to implement this depend on the stack:
- Database-level row isolation (e.g. row-level security in Postgres, IAM policies in DynamoDB, scoped queries enforced server-side)
- Application-level access control (every read filters by current-user ID)
- Service-account separation (the credentials your app uses on behalf of a user differ from the credentials your background jobs use)

The principle: **defence in depth**. Even if one layer fails, the next should still block unauthorised access. Don't rely on a single check.

## Privileged-function discipline

When your application has functions that execute with elevated privileges (e.g. SECURITY DEFINER in Postgres, sudoers in shell, AWS service roles, an admin RPC layer):

- **Document them** — keep an inventory of which functions can read/write which data with which credentials.
- **Tighten search paths and namespaces** — don't let a privileged function be tricked into running against a malicious schema or table (relevant for SQL stored procedures specifically).
- **Audit-log invocations** — at least the mutations; ideally also the reads of personal data.
- **Limit who can call them** — explicit grants to the right role or service, never to the broadest role.

## Service / role separation

Your system likely needs at least three identity layers:
- **Anonymous / pre-auth** — used during signup, login, and other public flows
- **Authenticated user** — the role most application traffic uses
- **Service / admin** — used by background jobs, cron, internal tooling, and admin consoles

The service / admin role should never be exposed to client code. Service credentials live in:
- Environment variables (for server processes)
- A secrets manager (for production secrets that need rotation, sharing, or audit)
- Never in source control (gitignore enforced; pre-commit hooks if needed)

## Secret management

Long-lived secrets that server-side code needs:

- **Database credentials**: managed by the platform (e.g. cloud-managed DB) or in a secrets manager.
- **API keys for sub-processors**: secrets manager. Rotate on a schedule.
- **OAuth client secrets**: secrets manager. Rotate when staff with access leaves.
- **Webhook signing secrets**: secrets manager.

When a secret is suspected compromised: rotate immediately, verify dependent systems still work after rotation, document in the incident log.

For database functions or scheduled jobs that need secrets: most platforms offer an in-database vault or secret table that keeps secrets out of the function source. Use it.

## Logging hygiene at the architecture level

Application logs, error tracking, request logs, and database query logs are all places where personal data can leak unintentionally. The architecture-level principle: **don't include personal data in operational logs unless necessary, and when included, reduce to the minimum that preserves the operational signal.**

Practical measures:
- Sanitise IDs before logging (truncate UUIDs, hash emails).
- Strip raw external API response bodies that may echo submitted PII (sub-processor errors are notorious for echoing the offending value).
- Avoid logging full request/response bodies on read endpoints that return PII.
- Configure database query log redaction where supported.

See [layer 04](04-controls-and-processes.md) for concrete patterns and templates.

## Defence in depth

No single control should be the only thing standing between an attacker and user data. Every personal-data-protection finding worth taking seriously involves multiple controls failing simultaneously. When designing:

- Assume any single control can fail or be bypassed.
- Layer access controls so a missed check at one layer is caught at another.
- Make the audit trail comprehensive enough that even silent failures are detectable.
- When the platform offers a defence (RLS, IAM policy, network ACL, WAF, etc.), use it — even if your application code already enforces the same rule.

## Backwards compatibility (when changing personal-data handling)

If your application has live users, schema and behavioural changes that affect personal data must remain compatible with the lowest deployed version still in field use.

- Adding new optional fields and JSON keys is safe (older clients ignore them).
- Removing or renaming fields is breaking — coordinate with the lowest-permitted client version (force-update gate, version pinning, etc.) before shipping.
- Tightening validation in an existing function (e.g. rejecting a value that was previously accepted) silently breaks older clients. Coordinate.

For purely server-side or admin-only changes: backwards compatibility doesn't apply to client versions, but the admin tooling using the function must be re-deployed in the same release.
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 implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall