09 — Law and protecting the creator
Commandments VI and VII extended outward: a solo creator or sole trader shipping a public app is personally liable. Terms, privacy policy and disclaimers are their armor — written as carefully as a Environment (dev / prod) — Separate places where the app runs: “dev” for safe tests, “prod” for real users. Dev is a playground, prod is where real users are — the rules for each are completely different. more in the glossary → Migration (database) — A controlled change to the database layout — adding a column, a table or moving data — step by step. Like a renovation to plan: rebuilding data in a set order so nothing “collapses”. more in the glossary →. ⚠️ Engineering hygiene, not legal advice: get a lawyer before binding real users at scale.
Rules
- Never invent legal or identity data. Company name, tax ID, address =
[to be filled]placeholders the owner completes. A visible placeholder beats a plausible fake. - Never declare a practice the code doesn’t implement. “We anonymize”, “we delete after N days”, “we don’t read conversations” must be true in the code — ideally proven by a test (→ 11).
- One operator, named identically everywhere: terms, policy, footer, invoices, UI.
- Terms of service contain: the operator; what the service is and is not (e.g. “a comparison engine, not a seller”; “information, not medical/legal/financial advice”); user obligations (lawful use, age limit); limitation of liability; moderation and account termination; IP (users keep their content, grant a license); governing law of your jurisdiction, complaints, how changes are announced, contact.
- The privacy policy contains: the controller; each data category with purpose, legal basis and retention; third-party processors; user rights (access, erasure, export, objection); cookies; age; contact.
- Consent before trackers. Analytics and marketing scripts load only after consent.
- Disclaimers fit the domain: age gate for age-restricted content; “this is not advice” for health/legal/finance; crisis resources per region for sensitive products (→ 10).
- Terms ↔ policy ↔ UI ↔ code say one thing. A contradiction between layers is worse than a missing clause.
- Legal documents go into Day 0 as placeholders, not “later” (→ 07).
Security checklist (index)
One entry point; each rule is enforced where it lives.
- Secrets in env / a secret store, rotated on leak (→ 08).
- Auth and sessions: bcrypt or OAuth, security headers, rate-limit; sessions in a persistent store (→ 14).
- Authorization server-side: this user may touch this row/action — not just “logged in” (IDOR — A bug where changing a number in the address (e.g. /order/1042) shows someone else’s data because the server doesn’t check ownership. It’s one of the most common serious holes — only a server-side check protects against it. more in the glossary →).
- Input is hostile: validate shape, parameterize SQL — The query language for a database — the way you “ask” the database for data or change it. The universal standard for talking to a database. A badly written query can bog down the whole app. more in the glossary →, treat external and user content as data, not instructions (→ 15).
- Errors don’t leak: no stack traces, secrets or PII (personal data) — Information that identifies a person: name, email, address, phone number. They need special protection (GDPR) — they mustn’t end up in logs or on test servers. more in the glossary → to users or logs (→ 14).
- Quotas on paid/expensive Endpoint — A single “address” in an API you send a request to for a specific thing (e.g. the list of orders). Apps talk through endpoints — one endpoint = one function you expose. more in the glossary → (→ 14).
Anti-patterns
- 🚫 An invented tax ID, address or company name in the product.
- 🚫 Copy promising more than the product does (“fully anonymous”, “guaranteed prices”).
- 🚫 Terms and policy naming different operators or retention periods.
- 🚫 A legal page in one language inside a multilingual product.
- 🚫 Analytics loaded before consent.