You can get away with a lot of bad habits and still ship software. Security isn’t on that list. AI made this worse in a very specific way: it sped up writing code and also made it normal to paste your crown jewels into a random textbox and hope for the best. cycode
The only thing that keeps working is boring best practices. The stuff you set up once, complain about a few times, and then mostly forget about until the day some incident report quietly proves you were right. cu
Identity & auth: passwords are not security policy
If your “password policy” is “we require one special character,” you’re not doing security. You’re doing vibes. cloud-cover
Baseline I treat as non‑negotiable:
- Use a password manager. Not a spreadsheet, not “I’ll remember it,” an actual manager that stores long, unique secrets for every account. bitwarden
- Use long passphrases where you have to remember something yourself. Length beats cleverness; four to six random words or 16–20 random characters is a good floor. publications.gc
- Turn on MFA anywhere that can hurt you: email, cloud console, Git hosting, domain registrar, billing systems, anything tied to money or infrastructure. cu
On MFA types:
- Hardware keys (FIDO2 / security keys) are great if your org can deal with buying, issuing, and replacing them. They’re phishing‑resistant by design. terrazone
- TOTP apps are the default for most people. Not perfect, but a lot better than nothing. sentinelone
- SMS is what you use when you’re out of better options and stuck with a legacy stack. teampassword
For user‑facing apps, passkeys/WebAuthn are where the industry is headed. They bind authentication to the real domain, kill password reuse, and shrug off most phishing tricks because the private key never leaves the user’s device. If you can support passkeys, do it; if you can’t, at least make password + MFA painless so people don’t go out of their way to bypass it. corbado
Credentials: the fastest way to lose a weekend
Early on I wrote custom BI software in C++ for AT&T and decided I also needed to design my own “encryption” for shuttling database credentials around. No external crypto, all homegrown, very galaxy‑brain. I was proud of it right up until I realized I’d signed myself up to maintain bespoke security plumbing for the rest of that system’s life. cycode
The lesson: don’t invent your own secret‑handling system. Other people already did that, argued about it, broke it, fixed it, and wrapped it in tools. opsmoon
Rules I follow now:
- Never hardcode secrets. Not in code, not in “temporary” scripts, not in examples you think no one will ever copy and paste. wiz
- Use environment variables plus a secrets manager that fits your stack. The goal is centralized storage, access control, audit logs, and rotation, not heroics. cycode
- Assume anything that touched git is compromised. Not “maybe.” If a secret hit git, history means it’s effectively public to anyone who ever gets that repo. opsmoon
If a key lands in git, treat it like it’s already printed on stickers at a security conference. Rotate it, then rotate anything reachable through it—databases, downstream APIs, whatever it unlocked. wiz
Here’s the Python pattern I like. Boring, predictable, easy to audit:
import os
def get_db_url() -> str:
url = os.getenv("DATABASE_URL")
if not url:
raise RuntimeError("DATABASE_URL is not set")
return url
No “helpful” fallback to localhost with a default password, no magic dev shortcut that finds its way into production and becomes the next incident report. cycode
Least privilege: separate the scissors from the chainsaw
A lot of breaches follow the same script: someone gets in, and once they’re in, they can do everything. Fixing that is about making “everything” hard to reach. cycode
Concrete moves that pay off:
- Separate DB users for app vs admin. Your app should never connect as a superuser; it should only have the permissions it actually needs. opsmoon
- Use scoped API keys. If a service only needs read access to invoices, the key should not be able to delete customers, refund payments, and reconfigure the moon. wiz
- Keep staging and production apart. Different credentials at a minimum, separate accounts or projects if you can swing it, so a mistake in staging doesn’t become a production horror story. cycode
This is where the boring plumbing earns its keep: logging so you can see who used which key, backups so you’re not terrified to rotate credentials, tests so you can change permissions without bricking the app. None of that looks fancy on a slide, but it’s what lets you sleep when someone says “we need to revoke that key right now.” opsmoon
AI: treat prompts like external support tickets
I worked at a SaaS company that loudly sold “AI automation” for financial workflows. Under the hood, most of it was spreadsheet column mapping and data cleanup with some workflows taped on. The support team was weirdly cagey about how things worked, and at one point a team in South Asia suggested I fly out and watch them do their jobs in person. That did not happen, but the trust light started blinking red. cycode
The security angle is simple: people will paste real customer data anywhere if it helps them get unstuck. AI tools actually help, which makes this worse, not better. wiz
So treat AI tools like any other third‑party service you don’t control:
- Don’t paste production logs into AI tools. Logs love collecting tokens, emails, stack traces with secrets, and random debug dumps with “temporary” data that never got cleaned up. cycode
- Don’t paste secrets: no JWTs, API keys, private keys, session cookies, database URLs, or anything you’d be nervous seeing in a breach report. opsmoon
- Assume prompts are stored somewhere, at least for a while, and treat retention, employee access, and potential breaches the same way you would for any other vendor. wiz
If you need help debugging with AI, sanitize first. Strip identifiers, mask tokens, and reduce it to the shape of the problem, not the actual production data. If you’re on a team, build tools that sanitize by default so nobody has to remember to be careful while they’re stressed and trying to get an incident under control. cycode
A checklist that fits on one screen
| Area | Baseline practice |
|---|---|
| Passwords | Password manager + long, unique passphrases |
| MFA | Enabled for email, cloud, Git, registrars, billing |
| Secrets | Central secrets manager, never in git or configs |
| Rotation | Keys rotated on schedule and after any exposure |
| Access | Separate roles for app, admin, ops, and CI with least privilege |
Security isn’t a premium feature you tack on at the end. It’s a pile of boring defaults you wire in early so you don’t end up writing angry postmortems about “that time we leaked prod credentials into an AI prompt and spent a week cleaning up.” blueally
-Sethers