Skip to content
Ad slotPut your product on this line. It runs at the top of every page on IndieHacked.Advertise
Guides

How to secure your web app: free fixes before paid ones

Three fixes any founder can make this afternoon, three that need a paid plan, a privacy update or real code, and a prompt that does them in that order.

Written by the IndieHacked teamSecurity7 min read

Start with three free fixes: lock the accounts that can change your code, block the paths scanners try, and hold back new package releases for a few days.

Alerts on your logs, pausing accounts that abuse your limits and a managed attack ruleset come after, because each needs a paid plan, a privacy policy update or code of its own.

The prompt below walks your coding agent through the free three first and asks before it starts on the rest.

The three advanced fixes

Want your coding agent to walk you through it?Get the prompt

Do the free three first

Bots reach a new site before customers do. They ask for addresses like /.env, /.git and /wp-login.php, looking for a file someone forgot to protect, and an attacker who wants your users' data goes for the accounts that can change your code. The first three fixes below cost nothing and fit in an afternoon. The other three need a paid plan, a privacy policy update or real code, so they come after.

Fix 1: lock the accounts that can change your code

1Password's incident in November 2026 started at one employee's GitHub account. From there the attacker read private source code, pushed code to backend services and used it to download customer account records, according to 1Password's own update. Your repository, your host and your database are the way into your users' data, so they get the strongest sign-in you have.

  • Sign in with a passkey wherever the service offers one, and an authenticator app everywhere else. On GitHub a passkey counts as both your password and your second factor.
  • Cover every account that can deploy or read your data: the repository, the host, the database, the payment provider and the email account they all send password resets to.
  • Open each one's list of active sessions and access tokens. Sign out what you don't recognise and delete the tokens you no longer use.
  • Require a pull request to change your main branch where your GitHub plan allows it, so one stolen session can't push straight to production.
  • Keep keys out of your code and your agent's files while you're at it: how to keep API keys safe.

Fix 2: block the paths scanners try

A rule at your host's edge answers these requests before they reach your code, so a scanner gets a block page instead of a function run or an error in your logs. One rule covers the whole list.

Paths to deny
/.env, and anything that starts with it (/.env.local)
/.git
/.svn
/wp-admin, /wp-login.php and anything that starts with /wp-
any path that ends in .php
/phpmyadmin
/xmlrpc.php
/.aws
/.DS_Store
/server-status
  • Check first that none of these is a real page on your site. A PHP site can't block .php, and some apps serve one of the others on purpose.
  • On Vercel, add it as a custom rule with the Deny action. Custom rules are on every plan: 3 per project on Hobby and 40 on Pro.
  • On Vercel Pro you can also make the rule a persistent action, which keeps blocking that client for a time you set, such as an hour. Hobby doesn't have it.
  • On Cloudflare, the Free plan has 5 custom rules, and one rule with the Block action takes the whole list.
  • Test it: open yoursite.com/.env and expect the block page, then load your real pages to see they still work.

Fix 3: wait a few days before installing a new package release

A poisoned package does its damage between its release and the moment someone reports it and the registry takes it down. npm, pnpm, Yarn and Bun can each refuse versions younger than an age you set, so your installs skip that window. Three days is a common choice.

npm, in .npmrc (days)
min-release-age=3
pnpm, in pnpm-workspace.yaml (minutes)
minimumReleaseAge: 4320
Yarn, in .yarnrc.yml (the docs' example, a week)
npmMinimalAgeGate: 1w
Bun, in bunfig.toml (seconds)
[install]
minimumReleaseAge = 259200
  • npm, pnpm and Bun each take an exclude list for packages you publish yourself or a fix you need today: min-release-age-exclude, minimumReleaseAgeExclude and minimumReleaseAgeExcludes.
  • Add the delay after a big upgrade, not before it. A version younger than the delay can't be installed until it ages.
  • Check that your package manager is new enough to know the setting. Each one's current docs list it.
  • Turn on Dependabot alerts and security updates in your repository too, so a known hole in a package you use arrives as a pull request with the fix.

Advanced: three fixes that cost money or code

The next three are worth doing once your app has users to protect. Each needs something the free three don't: a paid plan, an update to your privacy policy, or a few days of building. Read the cost before you start.

Advanced: get an alert when someone probes your site

Your host sees every blocked request and every failed sign-in, and nobody looks until something breaks. Sending the logs to a log service lets you alert on what an attack looks like: a spike in blocked requests, bursts of 401, 403 and 429 answers from one address, failed sign-in codes and users hitting their limits.

  • On Vercel, log drains need the Pro plan, and Vercel's pricing table lists drained data at $0.50 per GB on Pro (November 2026).
  • Better Stack's free plan keeps 3 GB of logs a month for 3 days, enough to try alerts before you pay for more.
  • Each drained request carries the visitor's IP address and browser. An IP address is personal data, so name the log service in your privacy policy before you turn the drain on.
  • Alert on change, not on single events. One blocked scanner is normal. A hundred in a minute from one address is worth a look.

Advanced: pause accounts that keep hitting your limits

Per-account limits refuse an abusive account one request at a time, forever. A pause stops it until you've looked. You need the limits first: count each account's refusals per day, and pause the account when it passes a number you choose.

  • Decide what a pause means before you build it: writes and paid calls stop, while sign-in and exporting their data keep working.
  • Only a person lifts a pause, and every lift is logged with who did it and when.
  • Tell the user, with how to reach you. A real customer who hit a limit by accident should be back the same day.
  • Check that your terms let you suspend an account for abuse before you do it.

Advanced: a managed ruleset for common attacks

A managed ruleset catches known attack patterns, such as SQL injection and cross-site scripting in a request, without you writing the rules. On Vercel the OWASP core ruleset is on Pro and Enterprise, and on Pro the project must be a Priority project: $200 a month per project, with the inspection billed on top by usage (Vercel's docs, November 2026).

  • Start it in log-only mode for a week and read what it would have blocked. A rule that matches your own forms or API calls breaks your site for real users.
  • Move each rule group to block only once its week shows no real traffic in it.
  • On Vercel, Priority also brings anomaly alerts and higher rule limits, so if you pay for it, use it for the alerting above too.

Set it up with your coding agent

A prompt for Claude Code, Codex, Cursor or the agent you use. Fill in your setup at the end and it walks you through the work, one step at a time. Free with an account.

Questions founders ask

Is Vercel's firewall a WAF?

Yes. Vercel calls it the Vercel WAF. Custom rules are on every plan, persistent actions on Pro, and the OWASP core ruleset on Pro only for a Priority project.

Will blocking these paths break my site?

Only if one of them is a page your site really serves. Check your routes before you add the rule, then load your real pages once it is live.

What if I need a security fix that was released today?

Add that package to your package manager's exclude list, install the fix, and take it off the list again once the version is older than your delay.

Where to go next

All guides

A new guide every few days.

Weekly Unpack brings each one to your inbox. One email a week with founder stories, the playbooks behind them and the businesses we unpack in our interviews.

Plusand the Builder Kit come with it

Subscribing makes your account Plus and opens your Builder Kit: what your product needs next, written for your coding agent to do.

By subscribing you agree to our Privacy Policy.