Startups rarely get breached by sophisticated adversaries. They get breached because an admin panel had a default password, a database was exposed to the internet, an API key was committed to a public repository, or a dependency with a known vulnerability was never updated. The attack surface of a young company is mostly unforced errors, which is good news: a modest, disciplined checklist eliminates most of the realistic risk.
This article is ordered by return on effort. You can work through the first sections in a week with a small team. Later sections need more investment, but still fit within a startup’s constraints.
Start with an inventory and a threat model
You cannot protect what you cannot list. Spend an afternoon writing down:
- Every domain and subdomain, including forgotten staging sites.
- Every server, container platform, database, queue and storage bucket, and which are reachable from the internet.
- Every third-party service holding customer data or credentials: email provider, payment processor, analytics, support desk, source control, CI.
- Who has administrative access to each, and whether they still need it.
Then ask a simple question for each asset: “If an attacker controlled this, what is the worst outcome?” The answers tell you where to concentrate. For most startups the crown jewels are the production database, the cloud account root, the source repository and the email domain used for password resets.
Identity and access: the highest-leverage controls
Most serious incidents begin with a stolen or weak credential. These controls are inexpensive and effective.
- Single sign-on and MFA everywhere. Enforce multi-factor authentication on email, source control, cloud consoles, DNS, password managers and every admin tool. Prefer phishing-resistant factors (security keys or passkeys) for administrators, and authenticator apps over SMS.
- Use a team password manager. Ban shared spreadsheets and chat messages with passwords.
- Least privilege. Give people the minimum role they need. Separate production from staging accounts. Use IAM roles instead of long-lived user keys.
- Protect the root account. Lock away the cloud root user, enable hardware MFA, and use it only for the tasks that require it.
- Offboard quickly. Keep a checklist: revoke SSO, rotate shared secrets the person knew, remove repository access, and collect devices. Former contractors with live access are a common weak point.
- Secure the email domain. Configure SPF, DKIM and DMARC (start with
p=nonefor monitoring, then move toquarantineorreject). It stops spoofing of your domain, which attackers use against your customers and your own staff.

HTTP security headers and TLS
Headers are cheap protection against entire classes of browser attacks. A reasonable baseline:
| Header | Purpose | Example |
|---|---|---|
Strict-Transport-Security |
Force HTTPS | max-age=31536000; includeSubDomains |
Content-Security-Policy |
Restrict where scripts and resources load from | Start with report-only |
X-Content-Type-Options |
Stop MIME sniffing | nosniff |
Referrer-Policy |
Limit leaked URLs | strict-origin-when-cross-origin |
Permissions-Policy |
Disable unused browser features | camera=(), microphone=(), geolocation=() |
X-Frame-Options or CSP frame-ancestors |
Prevent clickjacking | frame-ancestors 'none' |
Content Security Policy is the most valuable and the hardest. Deploy it as Content-Security-Policy-Report-Only first, collect violation reports for a couple of weeks, and then enforce. Prefer nonces or hashes for inline scripts rather than unsafe-inline.
Here is an Nginx fragment that applies the simple ones:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Content-Security-Policy "frame-ancestors 'none'" always;
For TLS, use certificates from a public authority with automated renewal (Let’s Encrypt with ACME clients), disable TLS 1.0 and 1.1, and test your configuration with an external scanner such as SSL Labs. Set cookies with Secure, HttpOnly and SameSite=Lax (or Strict where practical). Verify with a header scanner after each deployment, because proxy and framework layers sometimes drop headers.
Secrets management
Leaked secrets are among the most common startup failures. Automated bots scan public repositories within minutes of a push.
- Never commit secrets. Add
.envto.gitignore, and install a pre-commit hook or CI step using a scanner such as gitleaks or trufflehog. Enable your platform’s built-in push protection for secrets. - Assume history is public. If a secret was ever committed, rotate it. Deleting the commit is not enough.
- Use a secrets manager (cloud provider’s, Vault, or a hosted service) for production values, and inject them at runtime instead of baking them into images.
- Separate secrets per environment. The staging database password should not unlock production.
- Scope and rotate. Give each service its own key with the narrowest permissions, set expiry where possible, and rotate on a schedule and after any suspected exposure.
- Keep secrets out of logs, error messages and client bundles. Anything in a frontend bundle is public, including “hidden” API keys. Put privileged calls behind your server.
- Document rotation. A runbook that says how to rotate the database password in ten minutes is worth far more than a policy document.
Dependencies and supply chain
A typical web application includes hundreds or thousands of transitive packages. You are responsible for all of them.
- Enable automated dependency updates (Dependabot or Renovate) and review them weekly. Small frequent updates are safer than annual big jumps.
- Run
npm audit,pip-audit,osv-scanneror equivalent in CI, and fail builds on high-severity issues with a known fix. Triage the rest: many advisories do not apply to how you use the library. - Commit lockfiles, and install with
npm cior the equivalent so builds are reproducible. - Pin base images by digest, use minimal images (distroless or slim), and scan them with a tool such as Trivy.
- Be careful with new packages: check maintainers, download counts and recent activity. Typosquatting and compromised maintainer accounts are real attack paths. Consider disabling install scripts by default where your ecosystem allows it.
- Generate a software bill of materials (SBOM) if customers or regulators ask for it.
- Protect your CI: limit who can modify workflows, use short-lived credentials via OIDC rather than stored cloud keys, and treat pull requests from forks as untrusted.
Servers, SSH and network exposure
If you run your own servers or virtual machines, the basics matter.
- SSH with keys only. Set
PasswordAuthentication no,PermitRootLogin no, and consider restricting users withAllowUsers. Use ed25519 keys, protect private keys with passphrases or hardware tokens, and manageauthorized_keyscentrally. - Do not expose SSH to the world if you can avoid it. Put it behind a VPN, a bastion host or a zero-trust access tool. If it must be public, run fail2ban or equivalent and consider a non-standard port as noise reduction (not as security).
- Firewall by default deny. Open only 80 and 443 publicly. Databases, Redis, Elasticsearch, admin consoles and monitoring dashboards should listen on private interfaces only. Exposed Redis and MongoDB instances are found by scanners constantly.
- Patch the operating system. Enable unattended security updates for the OS, and schedule reboots for kernel updates.
- Run services as unprivileged users, apply systemd sandboxing options, and use containers with read-only filesystems and dropped capabilities where practical.
- Separate environments at the network level, and give each service its own database user with only the privileges it needs. The application account should not be able to drop tables.
- Disable unused services and remove default accounts and sample pages.
Web application firewall and edge protection
A web application firewall (WAF) filters malicious traffic before it hits your code. Managed WAFs from Cloudflare, AWS, Fastly and others are inexpensive relative to their value. Use one for:
- Blocking known attack patterns such as SQL injection and cross-site scripting probes, using managed rule sets such as the OWASP Core Rule Set.
- Rate limiting login, signup, password reset and search endpoints to blunt credential stuffing and scraping.
- Bot management and country or ASN rules when abuse is concentrated.
- DDoS absorption at the edge.
Treat the WAF as a safety net, not a substitute for secure code. Start in log-only mode, review false positives, then enforce. Hide your origin servers by restricting inbound traffic to the CDN’s IP ranges, or use authenticated origin pulls; otherwise attackers bypass the WAF by hitting the origin directly.
In the application itself, apply the fundamentals from the OWASP Top 10: parameterized queries, output encoding, server-side authorization checks on every object access, CSRF protection for cookie-based sessions, strict input validation, and safe file upload handling. Hash passwords with Argon2id, scrypt or bcrypt, never a fast hash. Add rate limiting and lockout or step-up checks on authentication.
Backups and recovery
Backups are a security control as much as a reliability one, particularly against ransomware and destructive mistakes.
- Follow the 3-2-1 idea: three copies, two media types, one offsite. In cloud terms, back up to a separate account or region with write-once or versioned storage so a compromised production account cannot delete them.
- Encrypt backups and protect the keys separately.
- Automate them, monitor that they ran, and alert on failure or unusually small sizes.
- Test restores. An untested backup is a hope. Schedule a quarterly restore drill, time it, and record the result. Define your recovery point objective (how much data you can lose) and recovery time objective (how long you can be down), and verify that your backups meet them.
- Include configuration, DNS records, infrastructure code and secrets in your recovery plan, not just the database.
Logging, monitoring and detection
You cannot respond to what you cannot see. Centralize logs from the application, load balancer, authentication provider and cloud audit trail (CloudTrail or equivalent). Alert on events that matter: impossible-travel or repeated failed logins, new admin users, changes to security groups, root account use, spikes in 4xx and 5xx rates, and unexpected outbound traffic. Keep logs for at least 90 days, protect them from tampering, and keep personal data out of them. Uptime monitoring and certificate-expiry alerts catch the embarrassing failures.
Incident response
Every company will have an incident. The difference is whether it is the first time anyone has thought about it. A one-page plan is enough to start.
- Roles. Name an incident lead, a communications owner and a technical responder, with backups. Keep their contact details somewhere accessible when your systems are down.
- Detect and declare. Make it easy for anyone to raise an incident, and define severity levels.
- Contain. Isolate affected systems, revoke compromised credentials, block malicious IPs. Prefer containment that preserves evidence.
- Eradicate and recover. Remove the cause, restore from known-good backups, rotate every secret that could have been exposed.
- Communicate. Tell affected customers promptly and factually. Regulations such as GDPR require notifying authorities within 72 hours of becoming aware of certain personal-data breaches, and US state laws have their own deadlines. Know which apply to you before you need them.
- Learn. Hold a blameless post-mortem within a week, with concrete follow-up actions and owners.
Run a tabletop exercise twice a year: pick a scenario like “an engineer’s laptop with production access was stolen” and walk through the plan for an hour. The gaps you find will be embarrassing in a meeting and catastrophic in a crisis.
A suggested order of work
If you have limited time, do it in this sequence: MFA everywhere and an access review; secrets scanning and rotation; firewall and SSH hardening; automatic OS and dependency updates; backups with a tested restore; security headers and a WAF; logging and alerts; and finally the incident plan and tabletop. Revisit the list quarterly. When we review startup infrastructure at Datainter, the first three items alone usually remove the majority of findings.
Security for a small company is mostly about making the boring things reliable: access, patching, backups and a plan for the bad day.
Key takeaways
- Begin with an inventory of assets, access and data, so you know what you are protecting and who can touch it.
- Enforce MFA, least privilege and fast offboarding; stolen credentials cause most real incidents.
- Keep secrets out of code, scan for leaks, scope each key narrowly and practice rotation.
- Automate dependency and OS updates, scan in CI, and treat new packages and CI workflows as part of your attack surface.
- Close the network by default: key-only SSH behind a VPN or bastion, private databases, and a WAF with the origin locked to it.
- Maintain offsite, immutable backups, test restores regularly, and write a one-page incident plan you rehearse twice a year.

