Security is easy to ignore when you’re building fast. You’re focused on product, users, growth—security feels like something big companies worry about.
Then you get breached. Customer data is exposed. Trust evaporates. The company is set back months or killed entirely.
Security doesn’t require a dedicated team. It requires getting the basics right from the start.
What actually happens to startups:
Credential stuffing. Attackers use leaked passwords from other sites to try to log into yours. If your users reuse passwords (they do), accounts get compromised.
SQL injection. Improperly handled user input lets attackers read or modify your database.
XSS (Cross-Site Scripting). Malicious scripts injected into your site steal user data or sessions.
Exposed secrets. API keys, database credentials, or encryption keys committed to code or exposed publicly.
Phishing. Attackers trick employees into giving up credentials or access.
Dependency vulnerabilities. A library you use has a security flaw that attackers exploit.
These aren’t exotic attacks. They’re common, automated, and target startups constantly.
Don’t build authentication yourself. Use:
•
Auth0, Clerk – Full-featured auth services
•
Supabase Auth – If using Supabase
•
Firebase Auth – If in Google ecosystem
•
WorkOS – For enterprise SSO
•
Multi-factor authentication
Building auth yourself means getting all of this right. It’s not worth the risk.
•
Check against known breached passwords
•
Don’t use complexity rules (they don’t help)
Most auth services handle this for you.
Multi-factor authentication should be:
•
Required for admin accounts
•
Available via authenticator app (not SMS if possible)
SMS 2FA is better than nothing but vulnerable to SIM swapping. Authenticator apps are better.
Secure Session Management
•
Use HTTP-only, secure cookies
•
Set reasonable session expiration
•
Invalidate sessions on password change
•
Implement session revocation for sensitive actions
Encrypt stored data, especially:
•
User passwords (bcrypt, argon2—never MD5 or SHA1)
•
Sensitive user data (PII)
Most managed databases (Supabase, PlanetScale, AWS RDS) encrypt at rest by default.
•
Use HTTPS everywhere (no HTTP)
Platforms like Vercel, Netlify, and Railway handle this automatically.
•
Only collect data you need
•
Delete data you no longer need
•
Be thoughtful about what goes in logs
You can’t leak data you don’t have.
•
Never commit secrets to code
•
Use environment variables
•
Use secret management (Doppler, 1Password Secrets, AWS Secrets Manager)
•
Rotate secrets periodically
•
Audit who has access to secrets
Never interpolate user input into queries:
// BAD - vulnerable to SQL injection
db.query(`SELECT * FROM users WHERE email = '${email}'`);
// GOOD - parameterized query
db.query('SELECT * FROM users WHERE email = $1', [email]);
Use ORMs (Prisma, Drizzle) that handle parameterization automatically.
Escape user input when rendering:
// React escapes by default
<div>{userInput}</div> // Safe
// Dangerous - avoid unless absolutely necessary
<div dangerouslySetInnerHTML={{__html: userInput}} />
If you must render HTML, use a sanitization library like DOMPurify.
Cross-Site Request Forgery tricks users into making unwanted requests.
•
Use CSRF tokens for state-changing requests
•
Most frameworks include CSRF protection—enable it
Protect against brute force and abuse:
import rateLimit from 'express-rate-limit';
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limit each IP
});
app.use('/api/', limiter);
Apply stricter limits to sensitive endpoints (login, password reset).
Use Google Workspace on Your Domain
Set up Google Workspace on your project’s custom domain and create every employee and shared account there (for example, name@yourstartup.com). Don’t let critical tools end up owned by personal Gmail accounts.
•
Ownership stays with the company, not the individual
•
Admins can enforce MFA, reset passwords, and revoke sessions
•
Offboarding is clean when someone leaves
•
Shared aliases and groups (founders@, billing@, security@) survive role changes
Use those domain accounts for GitHub, cloud providers, Stripe, banking, analytics, support tools, and anything else that controls customer data or money. Migrating later is annoying and error-prone; do it from day one.
Principle of Least Privilege
Users, services, and systems should have only the access they need:
•
Admin features only for admins
•
Database users with minimal permissions
•
API keys scoped to specific operations
•
Third-party integrations with limited access
Always verify the user can access the resource:
// BAD - trusting user input
app.get('/user/:id/data', async (req, res) => {
const data = await db.getUserData(req.params.id);
res.json(data);
});
// GOOD - verifying authorization
app.get('/user/:id/data', async (req, res) => {
if (req.user.id !== req.params.id && !req.user.isAdmin) {
return res.status(403).json({ error: 'Forbidden' });
}
const data = await db.getUserData(req.params.id);
res.json(data);
});
IDOR (Insecure Direct Object Reference) is one of the most common vulnerabilities.
Log security-relevant events:
•
Login attempts (success and failure)
Logs help you detect and investigate incidents.
Keep Dependencies Updated
Vulnerabilities in libraries are common. Update regularly:
npm audit
npm update
Use Dependabot or Snyk to automate vulnerability alerts.
Managed databases, hosting, and infrastructure handle security patches, backups, and configuration. Unless you have specific expertise, managed services are more secure than DIY.
•
Backups stored in separate location
•
Regular backup restoration tests
•
Encryption of backup data
•
Restrict database access to application servers
•
Use VPCs for production infrastructure
•
Keep admin interfaces off public internet
•
Use allowlists for sensitive systems
Before something happens, know:
1.
Who’s responsible for security incidents?
2.
How will you communicate internally?
3.
How will you communicate with users?
4.
What are your legal obligations (breach notification)?
5.
Who do you contact (lawyers, PR, affected users)?
1.
Contain – Stop the bleeding. Revoke access, disable compromised systems.
2.
Investigate – What happened? What was accessed?
3.
Remediate – Fix the vulnerability. Reset credentials.
4.
Communicate – Notify affected users and relevant parties.
5.
Learn – What can you do to prevent this?
Many jurisdictions require notifying users of data breaches. Know your obligations (GDPR, CCPA, state laws).
•
[ ] Using managed authentication service
•
[ ] HTTPS everywhere with HSTS
•
[ ] Secrets in environment variables, not code
•
[ ] Parameterized database queries (no SQL injection)
•
[ ] User input escaped in templates (no XSS)
•
[ ] Authorization checks on all endpoints
•
[ ] Rate limiting on sensitive endpoints
•
[ ] MFA available (required for admins)
•
[ ] Dependencies regularly updated
•
[ ] Backups automated and tested
•
[ ] Audit logging for security events
•
OWASP Top 10 – Most common vulnerabilities
•
OWASP Cheat Sheets – Specific guidance by topic
•
HaveIBeenPwned – Check for breached credentials
•
Security checklist generators – SOC2 prep tools
•
Use managed auth—don’t build it yourself
•
Encrypt data at rest and in transit
•
Validate and escape all user input
•
Always check authorization—don’t trust user input
•
Keep dependencies updated
•
Have an incident response plan before you need it
•
Security basics take hours to implement, not weeks—do them now