Here's a truth that kills startups: security breaches don't wait for you to scale. A single data leak at the MVP stage can destroy customer trust, trigger regulatory penalties, and end your company before it starts. The excuse "we'll add security later" is how breaches happen.
Working with financial institutions at Avenue Code taught us that security isn't a feature — it's a foundation. Banking-grade security practices aren't just for banks. Every SaaS handling user data needs them from day one.
Here are the 15 non-negotiable security measures for your MVP. Skip any of these and you're building on sand.
1. HTTPS Everywhere — No Exceptions
Every connection to your application must use TLS. Not just login pages. Not just payment flows. Every single request.
- Force HTTPS redirects at the infrastructure level (not just application code)
- Use HSTS headers with a minimum
max-ageof one year - Include
includeSubDomainsto cover all subdomains - Register for HSTS preload lists
In 2026, there's no excuse for HTTP. Let's Encrypt provides free certificates. Vercel, Cloudflare, and AWS all handle TLS termination automatically. The cost is zero. The risk of not doing it is catastrophic.
2. Secure Authentication
Authentication is your first line of defense, and most MVPs get it wrong.
Password hashing: Use bcrypt with a minimum cost factor of 12, or Argon2id if your infrastructure supports it. Never SHA-256. Never MD5. Never store plaintext passwords (you'd be shocked how often this still happens).
Session management: Use HTTP-only, Secure, SameSite cookies for session tokens. Set reasonable expiration times. Implement session revocation on password change. Store sessions server-side — not in JWTs that can't be invalidated.
Multi-factor authentication: Support TOTP at minimum. SMS-based 2FA is better than nothing but vulnerable to SIM swapping. For SaaS products, offer MFA from launch — enterprise customers will require it.
We use Better Auth in our stack because it handles session management, password hashing, and MFA out of the box with sensible defaults. Reinventing auth is how you create vulnerabilities.
3. Input Validation on Every Boundary
Every piece of data entering your system is a potential attack vector. Validate everything:
- Server-side validation is mandatory. Client-side validation is a UX convenience, not a security measure.
- Use schema validation libraries (Zod, Valibot) to define strict types for every input
- Validate length, format, range, and type
- Reject unexpected fields — don't just ignore them
- Sanitize file uploads by checking MIME types, file headers, and enforcing size limits
The principle: never trust the client. Every API endpoint, every form submission, every webhook payload must be validated server-side before processing.
4. SQL Injection Prevention
SQL injection remains in the OWASP Top 10 because developers keep writing raw queries.
- Use an ORM like Prisma that parameterizes queries by default
- Never concatenate user input into SQL strings
- If you must write raw queries, use parameterized queries exclusively
- Enable query logging in development to catch suspicious patterns
- Use database-level permissions — your application user shouldn't have
DROP TABLEprivileges
With Prisma as your ORM, SQL injection is nearly impossible through normal usage. The danger comes from escape hatches — $queryRaw and similar methods that bypass parameterization.
5. Cross-Site Scripting (XSS) Protection
XSS lets attackers inject malicious scripts into pages viewed by other users. In a SaaS application, this means an attacker could steal session tokens, impersonate users, or exfiltrate data.
- React's JSX escaping handles most cases by default — it escapes HTML entities in rendered content
- Never use
dangerouslySetInnerHTMLwith user-provided content - Implement Content Security Policy (CSP) headers to restrict script sources
- Sanitize rich text input with libraries like DOMPurify before storage and before rendering
- Use
HttpOnlycookies so scripts can't access session tokens
6. CSRF Protection
Cross-Site Request Forgery tricks authenticated users into performing unintended actions. Your user visits a malicious site while logged into your app, and the malicious site submits requests on their behalf.
- Use CSRF tokens for all state-changing operations
- Implement
SameSite=StrictorSameSite=Laxon session cookies - Verify the
Originheader on sensitive requests - Next.js Server Actions include CSRF protection by default — another reason we chose Next.js for our architecture
7. Rate Limiting
Without rate limiting, attackers can brute-force passwords, scrape data, or overwhelm your API.
- Authentication endpoints: 5-10 attempts per minute per IP, with progressive delays
- API endpoints: Tiered limits based on authentication status and subscription plan
- Password reset: 3 requests per hour per email address
- Account creation: Limit registrations per IP to prevent spam accounts
Implement rate limiting at multiple layers: edge (Cloudflare, Vercel), application middleware, and database query level. A single layer isn't enough — attackers will find the gap.
8. Secrets Management
Hardcoded secrets in source code are the number one cause of preventable breaches.
- Never commit secrets to Git. Use
.envfiles locally and environment variables in production. - Use a secrets manager (Vercel Environment Variables, AWS Secrets Manager, Doppler) for production
- Rotate secrets regularly — API keys, database passwords, signing keys
- Audit your Git history for accidentally committed secrets using tools like
trufflehogorgitleaks - Use different secrets for development, staging, and production environments
9. Dependency Auditing
Your application is only as secure as its weakest dependency. And with Node.js projects pulling in hundreds of transitive dependencies, the attack surface is massive.
- Run
npm auditorpnpm auditin CI/CD — fail the build on critical vulnerabilities - Use Dependabot or Renovate to automate dependency updates
- Pin dependency versions in production (use lockfiles, always)
- Review changelogs before upgrading — supply chain attacks target popular packages
- Minimize dependencies. Every package you add is code you're trusting with your users' data.
The 2024 xz-utils backdoor and 2021 ua-parser-js hijacking proved that even widely-used packages can be compromised. Vigilance isn't optional.
10. Backup Strategy
Backups are security. When ransomware hits, when a database migration goes wrong, when an employee accidentally deletes production data — backups are your recovery path.
- Automated daily backups of your database with point-in-time recovery
- Cross-region backup storage — if your primary region goes down, backups should survive
- Test restores monthly — a backup you've never restored is a backup you don't have
- Encrypt backups at rest using AES-256
- Retain backups for 30+ days to catch delayed-discovery incidents
11. Logging and Monitoring
You can't respond to breaches you don't detect.
- Log all authentication events: logins, failures, password changes, MFA enrollments
- Log all authorization failures — repeated 403s indicate probing
- Log API usage patterns — sudden spikes suggest scraping or abuse
- Never log sensitive data — no passwords, tokens, or PII in log files
- Set up alerts for anomalous patterns: login failures from new geolocations, bulk data exports, privilege escalation attempts
- Use structured logging (JSON) so logs are searchable and parseable
12. Role-Based Access Control (RBAC)
Authorization failures cause more breaches than authentication failures. Users accessing data they shouldn't see is the most common vulnerability in SaaS applications.
- Implement RBAC from day one — not as a "V2 feature"
- Define roles with the principle of least privilege: users get the minimum permissions needed
- Check permissions on every API endpoint, not just in the UI
- Use DDD principles to model authorization as a core domain concept
- Audit permission changes — log who granted what access and when
In multi-tenant SaaS, RBAC intersects with tenant isolation. A user in Tenant A must never access Tenant B's data, regardless of their role. This requires tenant-scoped authorization checks on every query.
13. Data Encryption
Encryption protects data at rest and in transit. Both matter.
- At rest: Enable database-level encryption (PostgreSQL's
pgcrypto, or managed database encryption on AWS RDS / Supabase) - In transit: TLS for all connections (covered in item 1)
- Application-level encryption for sensitive fields: SSNs, financial data, health records
- Key management: Use a KMS (AWS KMS, Google Cloud KMS) — never store encryption keys alongside encrypted data
- Encrypt backups separately from the production database encryption
14. Security Headers
HTTP security headers are free protection. Configure them once and they defend against entire categories of attacks.
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload Content-Security-Policy: default-src 'self'; script-src 'self' X-Content-Type-Options: nosniff X-Frame-Options: DENY Referrer-Policy: strict-origin-when-cross-origin Permissions-Policy: camera=(), microphone=(), geolocation=()
Test your headers at securityheaders.com. Aim for an A+ rating. It takes 30 minutes to configure and protects against XSS, clickjacking, MIME sniffing, and information leakage.
15. Incident Response Plan
When (not if) something goes wrong, you need a plan. Not a 50-page document — a practical runbook.
- Detection: How will you know a breach occurred? (Monitoring from item 11)
- Containment: Who has authority to take systems offline? What's the escalation path?
- Assessment: How do you determine what was accessed? Log analysis procedures.
- Notification: Legal requirements for breach notification (72 hours under GDPR, varies by US state)
- Recovery: Restore from backups, rotate all credentials, patch the vulnerability
- Post-mortem: What failed? How do you prevent recurrence?
Write this plan before you need it. Practice it. A startup with a tested incident response plan survives breaches. A startup without one often doesn't.
Security Is a Competitive Advantage
Enterprise customers evaluate security before signing contracts. SOC 2 compliance, penetration test reports, and security questionnaires are standard in B2B SaaS sales. Aligning your security posture with established frameworks like the NIST Cybersecurity Framework signals maturity to enterprise buyers. Building security into your MVP means you're ready for these conversations from day one, not scrambling to retrofit security when a big deal is on the line.
When we built AeroCopilot — a platform handling aviation safety data — security wasn't negotiable. The same applies to your SaaS, regardless of industry. Your users trust you with their data. Earn that trust from the first line of code.
The 15 items on this checklist aren't aspirational. They're the minimum. Build them into your MVP development process and you'll ship with confidence instead of crossing your fingers.
