Security and privacy
After today, you can name the few mistakes behind most web application incidents and say where secrets and personal data should and shouldn’t live.
Dip your toes 1 min
Security is about who can get into a product. Privacy is about what it holds on people, where that data goes, and who can see it. Most incidents in web products come from ordinary mistakes, not clever attacks. A common one is a leaked secret: a password or a key that unlocks a service, pasted where strangers can read it. GitHub scans the code people store on it for strings that look like keys, and can alert the company that issued them. Many of these choices start in design files: what a form asks for, who can see what, and how sharing works. Every personal detail a form asks for is data someone has to protect.
The full lesson 10 min
Why this exists
Most web application incidents don’t look like movie hacking. They start with an ordinary mistake: a password pasted into the wrong file, a missing permission check, a form that trusts whatever people type. Attackers run automated tools that scan the internet for exactly these mistakes, all day, against every product at once. A small team’s product gets probed the same way a bank’s does.
Stolen passwords and phishing, messages that trick people into giving theirs away, cause many others. Day 17’s passkeys resist both, and a code sent to a phone makes a stolen password alone useless.
Privacy fails in quieter ways. Personal details get copied into places nobody meant to keep them, and they stay there for years. Then a breach, a lawsuit, or a deletion request reveals how far they spread.
Security asks who can get in. Privacy asks what you hold about people, where it went, and who can see it. Both come down to a handful of patterns, and designers shape more of them than they think.
Security can look like engineering-only work, but many of its decisions are product decisions. What a form asks for, what one user can see about another, and who can share what are all choices made in design files. Engineers enforce those choices in code. A designer who knows the common failure patterns can spot a risky flow while it’s still a sketch, when changing it costs nothing.
What it is
The OWASP Top 10, the list Day 17 cited, ranks the most common risks in web applications. Its 2025 edition puts broken access control first: a product that lets someone see or change what they shouldn’t. The fix is a check on the server for every request.
Next come security misconfiguration, a setting left more open than intended, and software supply chain failures. A supply chain failure is a dependency, the outside code from Day 3, that brings in vulnerable or malicious code. Three patterns on that list, or close to it, cause many of the rest.
- Injection. An attack where text a user supplies gets treated as part of a command instead of as plain data. The classic case is a search box whose text gets pasted straight into a database query. The fix is to keep data and commands apart, which modern database libraries do when teams use them as intended.
- Cross-site scripting. A kind of injection where text one user supplies runs as code in other users’ browsers, often shortened to XSS. A comment, a display name, or a product review is the usual way in. Frameworks like React show text as text by default, which blocks most of it.
- Leaked secrets. A secret is any value that grants access to a system: an API key, a database password, a webhook signing secret. Whoever holds one can act as your product. Secrets leak when they land somewhere other people can read.
None of these needs a brilliant attacker. Each one is a system trusting something it shouldn’t: text from a stranger, a request it never checked, or a file anyone can open. That’s why security reviews keep asking the same question in different forms. Where does this come from, and who else can see it?
Secrets deserve the most attention, because they’re the easiest to leak and the hardest to take back. The rule is that code names a secret but never contains its value. The value lives in a secrets store, a locked service that holds secret values and records who reads them. AWS Secrets Manager, Google Cloud Secret Manager, and HashiCorp Vault are common ones, and hosting platforms offer their own. When the server starts, it receives the values it needs.
// The code names the key. The value arrives when the server starts.
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
Here, process.env holds environment variables (Day 5), settings the server receives when it starts. Anyone reading the repository sees the name STRIPE_SECRET_KEY and nothing else. The value never enters Git, never shows up in a pull request, and never ships to a browser.
GitHub knows this rule gets broken, so it runs secret scanning. It searches repositories for strings that look like known kinds of keys. It checks the full Git history on every branch, plus issues and pull request comments.
Secret scanning runs for free on public repositories. When it finds a key issued by a partner, like a cloud provider or a payment company, GitHub notifies that company, which can revoke it. Push protection acts a step earlier and blocks a push that contains a recognized secret.
Notice what secret scanning implies about Git. Deleting a key in a later commit doesn’t erase it from history, so it stays readable in the old one. That’s why GitHub’s secret scanning docs tell you to rotate a leaked credential right away: revoke it and issue a new one. Once a secret has been seen, the only fix is to make it worthless.
The last piece is encryption, scrambling data so only someone holding the right key can read it. Data gets encrypted in transit, as it travels across networks, and HTTPS, the encrypted form of HTTP from Day 9, does that for web traffic. It also gets encrypted at rest, as it sits on disks and in databases, so a stolen drive is unreadable. Encryption protects data from people outside the system. It doesn’t stop your own app from showing data to the wrong user, because the app holds the keys.
Privacy centers on personally identifiable information, or PII: any data that can identify a specific person, alone or combined with other data. Names, email addresses, phone numbers, and precise locations all count. Laws like the European Union’s GDPR (General Data Protection Regulation) give people rights over that data. Those include the right to see what a company holds about them and to have it erased.
How it shows up in your work
Some fields let one person type and another person read. Comments, reviews, display names, chat messages, and rich-text editors all qualify. In a design review, ask what happens if someone types something that looks like code. A good team has a short answer: it gets shown as text. The risky features are the ones that let users format content, embed media, or paste HTML, because those let some code through on purpose.
A tracking plan is where personal data spreads quietly. Designers often help decide which events analytics records, such as a sign-up or a visit to the pricing page. It’s tempting to attach the user’s email address to each event so it’s easy to look someone up later. That copies PII into another company’s tool, with its own access rules and its own retention.
The same goes for an email address in a URL, because URLs land in server logs, analytics, and browser history. Use an internal user ID instead. It still counts as personal data, but nobody who sees the event can read it or email it.
Prototypes and demos carry their own risk. Designers who build working prototypes, especially with AI coding tools, end up holding real keys. A key pasted into frontend code ships to every visitor, and a key pushed to a public repository gets found by automated scanners. The same care applies to data. A prototype filled with real customer records is a copy of PII on a laptop, in a design file, or behind a shared link.
Frameworks can make this mistake easy. In a Next.js app, any environment variable whose name starts with NEXT_PUBLIC_ gets copied into the browser code when the app is built. That prefix is a label meaning “this one isn’t a secret,” so a secret key never belongs behind it. Use test keys and made-up data, and ask an engineer before anything real goes in.
Other security calls live entirely in design files. A sign-in or reset screen that says “No account with that email” tells a stranger who has an account. Neutral copy like “If that email is registered, we’ve sent a link” doesn’t. A sharing setting of “anyone with the link” turns the link itself into a password that gets forwarded and pasted. Permission screens, where an app asks for contacts, location, or the camera, decide how much personal data the product collects at all.
The one thing people get wrong
Ask where a product keeps personal data, and most teams point to the database. The team designs the users table carefully, encrypts it, and limits who can query it. Then the same email address gets written somewhere else every time the system does its normal work. Each copy has its own access rules, its own retention period, and its own way of leaking.
Here’s how that happens during one sign-up. The server logs each request, and the log line includes the form fields. The analytics tool receives a “signed up” event with the email attached.
A crash during sign-up sends an error report that includes the request. A support ticket quotes the customer’s message, email and all. None of these was a decision to store PII; each was a default nobody questioned.
This matters most when someone asks to be deleted. Under laws like GDPR, a deletion request covers every copy, not only the row in the database. A team that can’t find the copies can’t honor the request. The lasting fix is to collect less in the first place, which privacy specialists call data minimization. Every field on a form is data someone has to protect, and the designer decides which fields are there.
Retention matters as much as collection. Logs, backups, and analytics exports often keep data far longer than anyone remembers. A sensible team decides how long each copy should live and deletes it on schedule. It also strips or masks personal fields before they reach logs and error reports. Those are engineering tasks, but they start with someone asking where the data goes.
Ask an engineer this
“If one of our API keys leaked tomorrow, how would we find out, and how long would it take to replace it everywhere it’s used?”
Bring this up before a launch, not after an incident, and focus on the key that matters most, like the payment provider’s. Detection should get a quick reply: secret scanning, an alert from the provider, or strange activity on the account. Then notice whether replacing the key is one step or a scavenger hunt across services and environments. If nobody knows where every copy of a key lives, that’s the finding. Either way, you learn how ready the team is for an incident that happens to companies of every size.
Terms from today
- Injection
- An attack where text a user supplies gets treated as part of a command, such as a database query, instead of as plain data.
- Cross-site scripting
- A kind of injection where text one user supplies runs as code in other users’ browsers, often shortened to XSS.
- Secret
- Any value that grants access to a system, like an API key, a database password, or a signing secret, which must never appear in code or reach a browser.
- Personally identifiable information
- Any data that can identify a specific person on its own or combined with other data, like a name, an email address, or a precise location, often shortened to PII.
- Encryption
- Scrambling data so that only someone holding the right key can turn it back into a readable form.